Skip to content

Instantly share code, notes, and snippets.

@oslego
oslego / jQuery Custom Events Bubble.js
Created December 11, 2010 19:57
Custom jQuery events triggered on non-DOM elements that bubble (propagate) up to the 'document'
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
(function($){
//non-DOM object events that propagate up to the 'document'
@jlongster
jlongster / gist:1288142
Created October 14, 2011 20:00
Bugzilla jsonrpc
function jsonrpc(user, method, params, http_method, cont) {
if(_.isFunction(http_method)) {
cont = http_method;
http_method = 'GET';
}
var request;
var opts = {
@paulirish
paulirish / data-markdown.user.js
Last active February 6, 2024 10:41
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@events =
events: {}
on: (topic, handler, context = this) ->
(@events[topic] or= []).push {handler, context}
trigger: (topic, args...) ->
return unless @events[topic]?
handler.apply(context, args) for {handler, context} in @events[topic]
@streunerlein
streunerlein / gist:3332181
Created August 12, 2012 14:58
NPM Mirrors & Proxies

Definition

Mirrors: standalone servers with complete copy of npm registry

Proxies: proxy to the database (couchdb) of npm registry, if only the npm registry server fails but the db works

## HowTo See this gist: https://gist.github.com/3331671

Mirrors

(+) means server is self updating (pulls newest stuff from offical registry when back online again)

@Integralist
Integralist / detect.js
Created October 23, 2012 12:05
Detect CSS Animation support and provide object of normalised properties
function CSSAnimation(){
/*
webkitAnimationName => Safari/Chrome
MozAnimationName => Mozilla Firefox
OAnimationName => Opera
animationName => compliant browsers (inc. IE10)
*/
var supported = false;
var prefixes = ['webkit', 'Moz', 'O', ''];
var limit = prefixes.length;
@oslego
oslego / noquery.js
Created October 31, 2012 22:42
Small jquery-like experiment
var $ = function(){
function noQuery() {
var args = Array.prototype.slice.call(arguments, 0)[0],
query = args[0]
qsa = function(q){
return Array.prototype.slice.call(document.querySelectorAll(q), 0)
}
this.el = []
@sl4m
sl4m / gist:5091803
Created March 5, 2013 16:57 — forked from trcarden/gist:3295935
create self-signed certificate for localhost
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@gustavohenke
gustavohenke / svg2png.js
Created February 18, 2014 15:27
SVG to PNG
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
var img = document.createElement( "img" );
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) );
img.onload = function() {