Skip to content

Instantly share code, notes, and snippets.

@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@aemkei
aemkei / LICENSE.txt
Last active June 4, 2024 07:51 — forked from 140bytes/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@paulirish
paulirish / rAF.js
Last active July 2, 2024 11:59
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'];
@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
@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>
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>
///
<div id='sidebar'>
<%= section(:sidebar) || partial(:default_sidebar) %>
</div>

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

}

@jackfuchs
jackfuchs / jquery.support.cssproperty.js
Last active January 13, 2024 16:07
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}
*
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)})()