michaelfox + snippets   48

Pears - common patterns of markup & style
Collect, test, and experiment with interface pattern pairings of CSS & HTML. Pears is an open source WordPress theme, enabling people like you to get your own pattern library up and running quickly.

Grab the theme at Github.
Install the theme.
Create markup & style patterns.
Learn.
css  html  html5  css3  framework  patterns  bestpractices  snippets  wordpress  php  elements  reference  forms  breadcrumbs  buttons  pagination  tables  slats  thumbnails  lists 
11 weeks ago by michaelfox
Unreleased stuff... — Gist
This list will hopefully shrink faster than it can grow. (yeah, right)

## jQuery

jQuery deparam / deparam+ / sortObject (WIP)
<https://gist.github.com/1025817>

jQuery infiniteScroller (WIP)

jQuery scrollinout event
<http://benalman.com/code/projects/jquery-scrollinout/examples/scrollinout/>

jQuery Sphere 3D
<http://benalman.com/code/projects/jquery-sphere3d/examples/flickr/>

jQuery Farthest Decendant: Dedicated to [Kris Borchers](http://twitter.com/rewardjs/status/75843907744833536)
<https://gist.github.com/1003361>

jQuery Data+: a new signature to allow easy initializing/getting of a per-element "state object"
<https://gist.github.com/979530>

jQuery Detach+: Improve .detach to allow optional reattaching!
<https://gist.github.com/978520>

jQuery Random: Add an "element of surprise" into the chain!
<https://gist.github.com/964822>

Like jQuery's .one but runs only once, across multiple elements and/or event types.
<https://gist.github.com/894952>

jQuery seq: execute code sequentially, for each selected element.
<https://gist.github.com/850322>

jQuery Floating Scrollbar
<https://gist.github.com/846423>

jQuery Widget Bootstrap: Experimenting with loading widgets that are dependent on jQuery...
<https://gist.github.com/816746>

jQuery htmlDoc "fixer" - get HTML, HEAD, BODY in your $(html)
<https://gist.github.com/742952>

jQuery nodetype filter: Filter the selected elements by nodeType
<https://gist.github.com/705550>

jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
<https://gist.github.com/661855/c119783954e1b10551c4afef53b2c04fefcb7465>

jQuery log selector: See what your selectors are selecting!
<https://gist.github.com/640714>

jQuery queueFn
<https://gist.github.com/36f3be40777bd70706b9>
<https://gist.github.com/330793>

jQuery liveOne: The power of .live and .one, together at last!
<https://gist.github.com/500667>

jQuery bindAndTrigger: Bind an event handler and fire it immediately
<https://gist.github.com/385142>

jQuery scrollable selector
<https://gist.github.com/331331>

## JavaScript

JavaScript: What's New? List properties that have been added to an object between a starting and ending point.
<https://gist.github.com/1027709>

Small Walker: A small and simple JavaScript DOM walker
<https://gist.github.com/958000>

JavaScript detach: detach a node from the DOM, optionally reattaching it when done.
<https://gist.github.com/938767>

JavaScript Curry
<https://gist.github.com/721002>

whatevCache: a simple localStorage-if-you-got-it, otherwise not-at-all-persistent data object cache.
<https://gist.github.com/658526>

postMessage detector
<https://gist.github.com/581030>

isSemVer - semantic version comparison for JavaScript
<https://gist.github.com/566233>

## Ruby

Gaucho (WIP)

Ruby: Clone Yer GitHub Repos, Fast!
<https://gist.github.com/916434>

Ruby: Unindent arbitrarily-indented heredocs
<https://gist.github.com/826577>

## Applescript

Finder Open iTerm Here
<https://gist.github.com/905546>

## Bash

Multi-Firefox Fixer: Run multiple versions of Firefox simultaneously!
<https://gist.github.com/868662>

## Articles

What results can you get just using these characters: +[]
<https://gist.github.com/984932>

JavaScript: A few ways to work around the lack of `this` propagation in inner functions
<https://gist.github.com/980016>

JavaScript var indenting thoughts.
<https://gist.github.com/946689>

jQuery.sub() "module-specific jQuery extensions" usage example for jQuery 1.5+
<https://gist.github.com/804811>

What == what?
<https://gist.github.com/1036978>
jquery  javascript  reference  resources  plugins  snippets  hacks  tutorials  tools  utility  github  github-gist  user:cowboy 
june 2011 by michaelfox
Doug's AppleScripts for iTunes ♫ Missing Menu Commands
This is a list (a very subjective list) of scripts that perform tasks you may wish were actual iTunes Menu commands. Just copy and paste 'em to your AppleScript Editor and save to your iTunes Scripts folder...then add a Shortcut.

Optionally, you can click the mini-AppleScript Editor icon link beneath each snippet to open the script in AppleScript Editor on your computer. These links use URL Protocol Messaging to safely and securely send the contents of the script to your AppleScript Editor application.

12 Second Fade/Stop and Next Track
Artist to Album Artist
Choose Playlist
Current Track to (Select Playlist)
De-Shuffle All Playlists
Delete Selected Playlists
Eject iPods
Erase Bookmark
Jump to Playlist
Just Played These
Open iTunes Scripts folder
Play Random Playlist
Play Random Track of Random Playlist
Play Selected Track Once
Remove (Album Version)
Remove SOME TEXT From Names
Reset Start and Stop Times
Search Results to New Playlist
Selected Tracks to Current Playlist
Set Skipped Count/Skipped Date
Show Get Info Window of a Track's File
Skip Ahead n Seconds
Skip and Pretend We Played This
Super Shuffle
Toggle Checkmarks of Selected
Toggle Mute
View Current Playlist
Virgin Again
itunes  applescript  snippets  resources  code  source 
december 2010 by michaelfox
Doug's AppleScripts for iTunes ♫ Spare Parts
Selection Routines
Single Selected Track
Get a reference to a single selected track.
Each Selected Track
Get a list of references to each selected track.
Select Playing or Single Selected Track
Get a reference to the current track if player is paused or playing; otherwise, check for a single selected track.
Selected Tracks or Entire Playlist
Repeat with a reference to each of the selected tracks; or, if no tracks are selected, repeat with a reference for each track in the currently selected playlist.
Handlers
Is iTunes Running
Returns true or false.
Choose/Restore Encoder
Change encoders on-the-fly and restore Preferences-set encoder afterwards.
Nuke Track 1
Delete a track from iTunes entirely.
Nuke Track 2
Delete a track from iTunes entirely and delete its file immediately (and unrecoverably).
Nuke Track 3
Delete a track from iTunes entirely and move its file to the Trash.
text_to_list(), list_to_text(), replace_chars()
Frequently helpful text and list handlers.
Basic Idle Routine
Checks for new current track. Save as Stay-Open Application.
List Manually Managed iPods
Sets two corresponding lists to manually managed iPod names and source references
Export Artwork as File to Folder
Supply an iTunes track reference, path to folder as text, name of new file as text, and scale in pixels. NOTE: probably will not work with iTunes 9/Snow Leopard. See the slightly updated version below.
Export Artwork as File to Folder II
Supply an iTunes track reference, path to folder as text, name of new file as text, and scale in pixels.This version seems to work better in Snow Leopard with iTunes 9
Rating to Text Stars
Pass the value of a track’s rating property. Regretably, the chevrons in the Unicode do not translate into UPM so you’ll have to copy-and-paste this off the page.
itunes  applescript  snippets  resources  code  source 
december 2010 by michaelfox
altfontprev - Project Hosting on Google Code
AltFontPrev is a JavaScript bookmarklet that allows you to preview how any website would look if a particular font was not available or a different font chosen. Each font used to style elements on the page is listed under its selector and, when clicked, is moved from being a fall-back to being the primary font.

As well as choosing a font from the existing CSS declarations, you can type a custom font to override everything. Hopefully this will help you choose alternative fonts when perfecting your site’s typography.
fonts  javascript  typography  debugging  design  ux  tools  testing  development  snippets  bookmarklets 
november 2010 by michaelfox
Kicking the Vim cursor key habit « lamby
" Unbind the cursor keys in insert, normal and visual modes. for prefix in ['i', 'n', 'v'] for key in ['<Up>', '<Down>', '<Left>', '<Right>'] exe prefix . "noremap " . key . " <Nop>" endfor endfor
vim  keyboard  shortcuts  vimrc  snippets  setup  environment  tools  resources  reference  tips  editor 
november 2010 by michaelfox
Highlight Microformats with CSS | The Hickensian | Hicksdesign
Those that use Firefox with the Tails extension, read no further. This is not for you. You have it given to you on a plate, you don’t know how lucky you are. This is for those of us using Camino, Safari or Omniweb.

After I mocked up an image of how Microformats detection might work in Safari, I started looking at the tools there were available. While there wasn’t anything that handled detection, Tantek did release his bookmarklets to allow hCard and hCalendar information to be exported from a page. Nothing in the region of Tails where you could view a list and choose which contacts/events you wanted, but it worked. This just left some way of handling detection, until I came across Chris Casciano’s script for NetNewsWire to Extract Microformats. It was a simple solution too – use css to style .vcard and .vevent classes differently.

So I’ve knocked up one of my own as a starting point. Here it is in action on Adactio, a rich harvest of microformats to be highlighted:

Example of the highlight microformats css in action

Here’s the file to download: expose-mf.css

It may work better with some designs than others. So far, I’ve not come
css  design  microformats  webstandards  semanticweb  http  semantic  uri  url  canonical  href  link  semantics  rdf  reference  architecture  webdev  seo  data  w3c  metadata  development  web  snippets 
october 2010 by michaelfox
Rich snippets (microdata, microformats, RDFa) - Webmaster Tools Help
Rich snippets (microdata, microformats, RDFa)

o Rich snippets (microdata, microformats, and RDFa)
o Breadcrumbs
o About microdata
o About microformats
o About RDFa
o Nested items
o Recipes
o Reviews
o Review ratings
o People
o Events
o Businesses and organizations
o Products
o Videos: Facebook Share and RDFa
o Rich snippets testing tool
markup  microformats  search  rdfa  reference  resources  google  seo  semantic  semantics  html  html5  data  microdata  semanticweb  snippets 
october 2010 by michaelfox
leftZeroPad [javascript] [formatting]
var MANY_ZEROS = "000000000000000000";

function leftZeroPad(val, minLength) {
if (typeof(val) != "string")
val = String(val);
return (MANY_ZEROS.substring(0, minLength - val.length)) + val;
}



leftZeroPad(3, 2) ==> "03"
pad  leftpad  format  string  javascript  snippets 
october 2010 by michaelfox
unobtrusive JavaScript to register code to be run once the page is loaded [javascript] [unobtrusive] [onload]
from http://simon.incutio.com/archive/2004/05/26/addLoadEvent

function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}


To add an event:

addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
addLoadEvent(function() {
/* more code to run on page load */
});


Tested on IE 5, 5.5 and 6 for Windows; IE 5 and Safari for Mac; Opera 7.5 and FireFox on Mac. Fails on Opera 6.
javascript  snippets  onload 
october 2010 by michaelfox
Add a JS function for bounded random numbers [javascript]
Math.randomMax = function(maxVal,asFloat){
var val = Math.random()*maxVal;
return asFloat?val:Math.round(val);
}



For a random integer between 0 and 10 (inclusive), simply:

var theNumber = Math.randomMax( 10 );



For a random float value between 0 and 10, pass a truth value to the second parameter:

var theNumber = Math.randomMax( 10, true );
javascript  snippets 
october 2010 by michaelfox
var_dump for javascript [javascript] [variable] [debug]
function var_dump(obj) { if(typeof obj == "object") { return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj; } else { return "Type: "+typeof(obj)+"\nValue: "+obj; } }//end function var_dump
javascript  logging  debugging  snippets 
october 2010 by michaelfox
Reading attribute values from a stylesheet [javascript] [css]
function getCssValue(selector,attribute) { selector = selector.toLowerCase(); var stylesheet = document.styleSheets[0]; var n = stylesheet.cssRules.length; for(var i=0; i<n; i++) { var selectors = stylesheet.cssRules[i].selectorText.toLowerCase().split(","); var m = selectors.length; for(j=0; j<m; j++) { if(selectors[j].trim() == selector) { var value = stylesheet.cssRules[i].style.getPropertyValue(attribute); if(value!="") { return value; } } } } debug("Could not find selector/attribute: "+selector+"/"+attribute); return null; },
javascript  snippets 
october 2010 by michaelfox
Include CSS Stylesheet by DOM [javascript] [css] [dom]
function includeCSS(p_file) { var v_css = document.createElement('link'); v_css.rel = 'stylesheet' v_css.type = 'text/css'; v_css.href = p_file; document.getElementsByTagName('head')[0].appendChild(v_css); }
javascript  snippets 
october 2010 by michaelfox
TextMate Manual » Snippets
A snippet is a piece of text that you would like to insert in your document. It can include code to run at insertion time, variables (like selected text), tab stops/placeholders for missing information (which you can tab through after insertion) and perform transformations on the data which you enter in the placeholders.

7 Snippets
7.1 Plain Text
7.2 Variables
7.3 Interpolated Shell Code
7.4 Tab Stops
7.5 Placeholders
7.6 Mirrors
7.7 Transformations
textmate  tools  snippets  regex  documentation 
june 2010 by michaelfox
Completion Dictionary - Release Notes
Completion Dictionary is a free Xcode plugin that enhances Xcode’s built-in code completion mechanism. You simply type a few letters - either the abbreviation of a macro or the initials of a symbol name - and press the completion shortcut. Completion Dictionary will do the rest.
Macro Expansion

A set of user defined macros is searched for an entry matching the abbreviation you’ve typed in. The macros may also contain a number of placeholders. The text range of these placeholders will be preselected, ready to be replaced with your further input.
Code Completion

Completion Dictionary integrates the built-in code completion capabilities of Xcode. If there’s no macro found for a given abbreviation, Xcode’s code completion will be performed instead of macro expansion.
Features

* Seamless Xcode integration with configurable fallback to Xcode’s code completion
* Built-in Macro Editor for quickly adding custom macros
* Full Undo/Redo support
* Free definable placeholders within the macros
* Query placeholders for macros that require additional user input
* Automatic indentation of multi-line macros, allows to insert code snippets properly indented.
* Comprehensive set of default macros (includes more than 190 macros)
xcode  cocoa  development  mac  osx  iphone  code  completion  tools  snippets  macros 
june 2010 by michaelfox
Conditional Logging - GreaseSpot
An even simpler option, retaining all of Firebug's console routines, and not interfering with additional parameters.

const DEBUG = 1;
if (!DEBUG) {
var console = {
log: function() {},
info: function() {},
warn: function() {},
error: function() {},
};
}
greasemonkey  userscripts  javascript  debug  console  firebug  firefox  logging  webdev  tools  snippets  code  browser 
april 2010 by michaelfox

related tags

apache  applescript  architecture  array  autocomplete  bash  bestpractices  boilerplate  book  bookmarklets  breadcrumbs  browser  buttons  calibre  canonical  cli  cocoa  coda  code  collection  communitywiki  completion  console  css  css3  curl  data  database  date  db  debug  debugging  design  development  documentation  dom  ebooks  editor  elements  emails  environment  epub  examples  ezsql  firebug  firefox  fonts  format  forms  forum  framework  gists  github  github-gist  google  greasemonkey  hacks  highlighting  howto  href  htaccess  html  html5  http  interface  ios  ipad  iphone  itunes  javascript  jquery  keyboard  leftpad  libraries  library  link  linux  list  lists  logging  mac  macros  markdown  markup  metadata  microdata  microformats  onload  osx  pad  pagination  patterns  php  plugins  preferences  programming  python  rdf  rdfa  reference  regex  resources  ruby  scripting  scripts  search  semantic  semantics  semanticweb  seo  setup  shell  shortcuts  showcase  slats  snippets  source  sql  string  sublime  suggest  syntax  tables  techniques  template  testing  text  textexpander  textmate  thumbnails  time  tips  tools  tutorial  tutorials  twitter  typography  ui  unix  uri  url  urls  user:cowboy  userscripts  utility  ux  vim  vimrc  w3c  web  webdev  webstandards  wordpress  xcode  xml  xsl  xslt  zend 

Copy this bookmark:



description:


tags: