This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [user] | |
| name = Adam Lloyd | |
| email = adam@alloy-d.net | |
| [alias] | |
| ci = commit | |
| co = checkout | |
| d = difftool | |
| st = status --short | |
| current = rev-parse --abbrev-ref HEAD | |
| autocommit = !"git commit -m \"$(curl -s 'http://whatthecommit.com' | grep -A1 'id=\"content\"' | tail -n 1 | tr -d '<p>')\"" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # It is acknowledged that all perl one-liners here are both inelegant | |
| # and probably great targets for replacement with sed. | |
| # Get a list of fully merged branches: | |
| git branch --merged | perl -pe '$_ =~ s/..//' > branches | |
| # edit branches to exclude branches that shouldn't be deleted (example: master) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Kernel | |
| alias_method :_orig_raise, :raise | |
| def raise(*args) | |
| begin | |
| _orig_raise(*args) | |
| rescue Exception => e | |
| Bugsnag.notify(e) | |
| _orig_raise(e) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define(function () { | |
| var exports = {}; | |
| funcs = ["log", "warn", "error", "group", "groupEnd"]; | |
| for (var i in funcs) { | |
| exports[funcs[i]] = (function (func) { | |
| return function () { | |
| if (typeof(console) !== "undefined" && funcs[i] in console) { | |
| console[func].apply(console, arguments); | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module AwarenessUtils | |
| # Example: `define_method :current_method_name, StackWalker.new(2)` | |
| class StackWalker < Proc | |
| def self.new(depth=1) | |
| super() { instance_eval { caller[depth] =~ /`(.+)'/ and $1 } } | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module OptionsWithIndifferentAccess | |
| module ClassMethods | |
| def method_added(method_name) | |
| unless caller[1].match(/`method_added'/) | |
| define_method("_orig_#{method_name}".intern, instance_method(method_name)) | |
| define_method(method_name) do |*args, &block| | |
| if args[-1].is_a? Hash | |
| args[-1] = HashWithIndifferentAccess.new(args[-1]) | |
| end | |
| self.send "_orig_#{method_name}", *args, &block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "name": "commenter[name]", // the name attribute; should also be used to create the id | |
| "text": "Your name (pseudonyms are okay)", // the text of an associated label | |
| "required": true, // this field should not be left blank | |
| }, // => A basic text field | |
| { | |
| "name": "commenter[email]", | |
| "text": "Your email address (will not be shown)", | |
| "type": "email", // this field represents an email address |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var beginningOfDayWithOffset = function (targetOffset) { | |
| var pad = function (n) { return (n.toString().length === 2 ? n.toString() : "0" + n) } | |
| var sign = "-"; | |
| var offsetHours, offsetMinutes, offsetString; | |
| // That's right, JavaScript's timezone offset has the opposite sign of the | |
| // offset in ISO 8601... | |
| if (targetOffset <= 0) { | |
| sign = "+"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // We're coding an awesome website. | |
| // | |
| // For a great user experience, we want to add a personalized greeting. | |
| // Here is a function that gives said personalized greeting, given the user's name. | |
| function greetUserLikeIts1995(firstName) { | |
| alert("Hello there, " + firstName + "!"); | |
| } | |
| // For security, we use carrier pigeons to get information from our users. | |
| // Unfortunately, it's a slow process, so we don't want to just sit around |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| [ | |
| {"caption": "Toggle Shown Spaces", "command": "toggle_shown_spaces"} | |
| ] |