Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
puts "looking for the gems to upgrade..."
gem_info = Struct.new(:name, :version)
to_reinstall = []
Dir.glob('/Library/Ruby/Gems/**/*.bundle').map do |path|
path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/
name, version = $1, $2
bundle_info = `file path`
to_reinstall << gem_info.new(name, version) unless bundle_info =~ /bundle x86_64/
end
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
javascript:(function(){$('option','#font-family').attr('disabled',true).filter(function(a){return ':contains('+a.replace(/\+/g,' ').split(',').join('),:contains(')+')'}('Cantarell,Crimson+Text,Droid+Sans+Mono,IM+Fell,Inconsolata,Josefin+Sans+Std+Light,OFL+Sorts+Mill+Goudy+TT,Reenie+Beanie')).attr('disabled',false)})()
@jackfuchs
jackfuchs / jquery.support.cssproperty.js
Last active July 19, 2024 17:38
Extends the jQuery.support object to CSS Properties
/**
* jQuery.support.cssProperty
* To verify that a CSS property is supported
* (or any of its browser-specific implementations)
*
* @param p css property name
* @param rp optional, if set to true, the css property name will be returned
* instead of a boolean support indicator
* @return {mixed}
*

Requires a function getItemIdFromElement($element) It should take a jQuery collection, and returns an identifier for that element.

getOrder returns a flat array with object similar to the following.

{
  level: 0,
  parent: 0,
  id: 1

}

<div id='sidebar'>
<%= section(:sidebar) || partial(:default_sidebar) %>
</div>
anonymous
anonymous / jquery.deepest.js
Created November 25, 2010 03:28
jQuery 'deepest' plugin
$.fn.deepest = function() {
/// <summary>
/// Return the deepest child of this element.
/// For example, when run on this structure:
///
/// <div>
/// <span> <b>pick me!</b> </span>
/// <span> </span>
/// </div>
///
@gourneau
gourneau / python-pil-image-sprite.py
Created April 24, 2011 02:45
Make sprites of images using Python and PIL
#!/usr/bin/python
# This work is licensed under the Creative Commons Attribution 3.0 United
# States License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by/3.0/us/ or send a letter to Creative
# Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
# from http://oranlooney.com/make-css-sprites-python-image-library/
# Orignial Author Oran Looney <olooney@gmail.com>
@marcuswestin
marcuswestin / javascript templating
Created December 2, 2011 22:28
Who needs fancy javascript templating languages when a good old 10-liner does the job.
<div id="output"></div>
<script type="text/html" id="greeting-template">
<div class="greeting">
Hello, {{ name }}!
</div>
</script>
<script>
function template(id, params) {
var html = document.getElementById(id).innerHTML
@paulirish
paulirish / rAF.js
Last active August 19, 2024 08:39
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];