Skip to content

Instantly share code, notes, and snippets.

View peebeebee's full-sized avatar

Peter Briers peebeebee

View GitHub Profile
@peebeebee
peebeebee / gist:9113261
Created February 20, 2014 13:14
Get jQuery function on handlers.
/**
* Type this in the console.
* Doubleclick on the handler information you want.
* It will show the REAL function that will be executed instead of the jQuery handler :)
*/
// >= jQuery 1.8
jQuery._data( $('.element').get(0), "events");
// <= jQuery 1.8
jQuery( $('.element').get(0) ).data( "events" );
@peebeebee
peebeebee / gist:9176850
Created February 23, 2014 20:33
Exit shell on error
#!/bin/sh -e
/*
When this option is on, if a simple command fails for any of the reasons listed in Consequences of Shell Errors or returns an exit status value >0, and is not part of the compound list following a while, until, or if keyword, and is not a part of an AND or OR list, and is not a pipeline preceded by the ! reserved word, then the shell shall immediately exit.
*/
@peebeebee
peebeebee / Capistrano
Created March 3, 2014 04:56
Capistrano
bundle exec cap production git:check --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
INFO [0e2870b7] Running /usr/bin/env mkdir -p /tmp/leukemissie/ on myhost.com
D, [2014-03-03T05:52:29.674278 #16552] DEBUG -- net.ssh.transport.session[3fc5a541b75c]: establishing connection to myhost.com:22
@peebeebee
peebeebee / gist:76a07b711b9da0120c76
Created May 15, 2014 10:02
Help & Support Alpha version theming
.page-help-and-support {
#content-inner {
width: auto;
}
.hs-bar {
position: relative;
overflow: hidden;
Index: content/plugins/wp-tell-a-friend-popup-form/wp-tell-a-friend-popup-form.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- content/plugins/wp-tell-a-friend-popup-form/wp-tell-a-friend-popup-form.php (date 1403968273000)
+++ content/plugins/wp-tell-a-friend-popup-form/wp-tell-a-friend-popup-form.php (revision )
@@ -49,36 +49,36 @@
<?php
}
@peebeebee
peebeebee / 0_reuse_code.js
Created July 1, 2014 07:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
// By observing changes to an object with Object.observe,
// and turning on Async Call Stacks in Chrome Dev Tools,
// you can find the source of those changes.
var myObject = {
foo: 'bar'
};
Object.observe(myObject, function(changes) {
// This asynchronous callback runs when myObject is changed
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
log = function(arg) {
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@peebeebee
peebeebee / gist:a27468df8aaca92fefc3
Created June 26, 2015 09:00
Handy Shell Functions
# .bash_profile
# Type `up 7` to do cd ../../../../../../..
function up() {
i=$1
while [ $i -gt 0 ]
do
cd ..
i=$(($i - 1))
done
}