Skip to content

Instantly share code, notes, and snippets.

View ginader's full-sized avatar

Dirk Ginader ginader

View GitHub Profile
@yatil
yatil / gist:1111608
Created July 28, 2011 14:03
Copy this to your browsers url bar and hit Enter
alfredapp://customsearch/caniuse/caniuse/ascii/url=http://caniuse.com/#eras=past,now,near&nodetails=1&search={query}
@themattharris
themattharris / weekday_diff.php
Created August 12, 2011 21:20
weekday_diff - calculates the number of weekdays between two dates.
<?php
/**
* Calculated the number of weekdays (M-F) between two timestamps (inclusive).
*
* @param string $from the timestamp to start measuring from
* @param string $to the timestamp to stop measuring at
* @param string $normalise whether the time of day should be ignored (forces times to yyyy-mm-ddT00:00:00+00:00)
* @return int the number of weekdays between the two timestamps
* @author Matt Harris
*/
@mathiasbynens
mathiasbynens / unsafeWindow.user.js
Created August 13, 2011 13:21
`unsafeWindow` polyfill (for use in user scripts)
// ==UserScript==
// @name Emulate `unsafeWindow` in browsers that don’t support it.
// ==/UserScript==
// http://mths.be/unsafewindow
window.unsafeWindow || (
unsafeWindow = (function() {
var el = document.createElement('p');
el.setAttribute('onclick', 'return window;');
return el.onclick();
@nzakas
nzakas / es6proxy.htm
Created September 8, 2011 01:02
Example of ES6 Proxy
<!DOCTYPE html>
<!--
This is a simple experiment relying on ECMAScript 6 Proxies. To try this out,
use Aurora (http://www.mozilla.org/en-US/firefox/channel/).
The goal was to create a HTML writer where the method names were really just
the HTML tags names, but without manually creating each method. This uses
a Proxy to create a shell to an underlying writer object that checks each
method name to see if it's in a list of known tags.
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@chriseppstein
chriseppstein / 0_selector_hacks.scss
Created September 14, 2011 04:27
This gist demonstrates some uses of the new sass feature: Passing content blocks to mixins.
@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}
yeti --connected
yeti info - checking for connected clients..
yeti info - clients closed: 11
yeti info - clients connected: 23
yeti info - clients open: 23
yeti info - browsers connected:
--------------------------------------------------------------------------------------------
| Browser | OS | IP |
--------------------------------------------------------------------------------------------
| Chrome (14.0.835.186) | Mac OS | 10.0.1.50 |
@rgrove
rgrove / gist:1265810
Created October 5, 2011 21:33
Better Y.throttle()
// New Y.throttle().
Y.throttle = function (fn, duration, context) {
var lastTime = 0,
lastArgs, timeout;
duration || (duration = Y.config.throttleTime || 150);
function execute() {
var args = lastArgs;
@reid
reid / move.html
Created October 12, 2011 22:47
Source of https://www.me.com/move while logged in.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- IMPORTANT NOTE: This file is licensed only for use in providing the MobileMe service,
or any part thereof, and is subject to the MobileMe Terms and Conditions. You may not
port this file to another platform without Apple's written consent. -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
@textarcana
textarcana / git-log2json.sh
Last active January 24, 2025 22:12
Convert Git logs to JSON. The first script (git-log2json.sh) is all you need, the other two files contain only optional bonus features 😀THIS GIST NOW HAS A FULL GIT REPO: https://github.com/context-driven-testing-toolkit/git-log2json
#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%aN <%aE>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'