Skip to content

Instantly share code, notes, and snippets.

View ginader's full-sized avatar

Dirk Ginader ginader

View GitHub Profile
// Step 1. global definition
function Map(config) {
this._init(config);
}
Map.prototype = {
_container: null,
_init: function (config) {
this._container = document.getElementById(config.container);
@bkeating
bkeating / howto-filemerge-git-osx.md
Created March 11, 2010 21:36
HOWTO: Using FileMerge (opendiff) with Git on OSX

HOWTO: Using FileMerge (opendiff) with Git on OSX

FileMerge (opendiff) can really come in handy when you need to visually compare merging conflicts. Other times it's just a nice visual way to review your days work.

The following method works by creating a simple bash script (git-diff-cmd.sh) that sets us up with the proper command line arguments for Git to pass off files to FileMerge.

#!/usr/bin/env ruby
## WP2TUMBLR: WordPress 2 Tumblr Importing tool
##
## Usage: wp2tumblr [OPTION] WORDPRESS_XML_FILE
##
## Import the WORDPRESS_XML_FILE to a Tumblr blog.
## Provide `--group` option to publish to a group.
## This could take a long time...
##
## To install, download the script and chmod to 755.
@paulirish
paulirish / gist:373253
Created April 21, 2010 00:08
jquery invert
// jquery invert plugin
// by paul irish
// some (bad) code from this css color inverter
// http://plugins.jquery.com/project/invert-color
// some better code via Opera to inverse images via canvas
// http://dev.opera.com/articles/view/html-5-canvas-the-basics/#insertingimages
// and some imagesLoaded stuff from me
// http://gist.github.com/268257
.mouse, #preview{
position: absolute;
background-repeat: no-repeat;
height: 22px;
min-width: 15px;
z-index: 100;
}
.mouse{
background-image: url('../images/cursor.png');
@premasagar
premasagar / tim.js
Created August 12, 2010 17:52
A tiny, secure JavaScript micro-templating script. It doesn't use eval or (new Function), so it cannot execute malicious code.
/*
== Tim ==
A tiny, secure JavaScript micro-templating script.
This has now moved to:
github.com/premasagar/tim
*/
@codepo8
codepo8 / localstorage.js
Created August 25, 2010 14:44
Store the state of a rendered form the easy way
<script>
// test for localStorage support
if(('localStorage' in window) && window['localStorage'] !== null){
var f = document.getElementById('mainform');
// test with PHP if the form was sent (the submit button has the name "sent")
<?php if(isset($_POST['sent']))){?>
// get the HTML of the form and cache it in the property "state"
localStorage.setItem('state',f.innerHTML);
/*
urldecoder.js
This simple service reveals the real URL behind a shortened one
Usage: fire it up with:
node urldecoder.js
Then access as follows:
@scottschiller
scottschiller / normalized-addremove.html
Created September 26, 2010 18:55
Somewhat-normalized event listener handling (DOM2)
<html>
<head>
<title>Somewhat-normalized event add/remove</title>
<script>
var addEvent, removeEvent;
(function() {
/*
* Somewhat-normalized event add/remove (old IE/W3C)
@mikewest
mikewest / backup-github.sh
Created October 11, 2010 17:57
"Oneliner" to backup your public github repos.
#!/bin/sh
# Run from a directory in which you'd like to shove a _lot_ of bare repositories.
curl -s http://github.com/api/v2/yaml/repos/show/mikewest | grep ':url:' | awk '{ print $2 }' | sed -e 's#http://#git://#' -e 's#$#.git#' | xargs -L 1 git clone --bare