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
| ;; M-x customize-variable RET magit-default-tracking-name-function RET | |
| ;; Set "other" to magit-tracking-name-unfucked-with | |
| (defun magit-tracking-name-unfucked-with (remote branch) | |
| branch) |
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
| (defun magit-quick-stash () | |
| "Immediately stash with mesage | |
| WIP on branchname: short-sha commit-message" | |
| (interactive) | |
| (magit-stash "")) | |
| (add-hook | |
| 'magit-status-mode-hook | |
| (lambda () |
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
| class Foo | |
| # always works | |
| def read_instance_property | |
| bar | |
| end | |
| # assigns thing, but not Foo instance thing | |
| def write_instance_property | |
| thing = 'baz' |
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
| Namespaced = {} | |
| class Foo | |
| constructor: -> | |
| @property = 'i am Foo' | |
| class Namespaced.Foo | |
| constructor: -> |
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
| (defun prettify-json () | |
| "NOTE: requires ruby in $PATH. Replace a valid json region with | |
| pretty printed json By default uses the jj method to print, | |
| uses pp if there is a prefix argument" | |
| (interactive) | |
| (let* ((print-method (if current-prefix-arg "pp" "jj")) | |
| (cmd (format | |
| "ruby -e 'require \"json\"; require \"pp\"; %s JSON.parse(gets)'" print-method))) | |
| (shell-command-on-region | |
| (region-beginning) |
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
| #! /usr/bin/env bash | |
| checkout_dir=$1 | |
| from_remote=$2 | |
| to_remote=$3 | |
| cd $checkout_dir |
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
| #! /bin/bash | |
| case "$1" in | |
| '' | -h | --help) | |
| NOARGS=1 ;; | |
| -d) | |
| DRY=1; FIND=$2 ;; | |
| *) | |
| DRY=0; FIND=$1 ;; | |
| esac |
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
| const crypto = require('crypto'), | |
| fs = require("fs"), | |
| http = require("http"); | |
| var privateKey = fs.readFileSync('privatekey.pem').toString(); | |
| var certificate = fs.readFileSync('certificate.pem').toString(); | |
| var credentials = crypto.createCredentials({key: privateKey, cert: certificate}); | |
| var handler = function (req, res) { |
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
| # RSpec matcher for validates_with. | |
| # https://gist.github.com/2032846 | |
| # Usage: | |
| # | |
| # describe User do | |
| # it { should validate_with CustomValidator } | |
| # end | |
| RSpec::Matchers.define :validate_with do |validator, options = {}| | |
| match do |subject| |
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
| (global-set-key (kbd "C-x C-s") 'force-save) | |
| (defun force-save () | |
| (interactive) | |
| (not-modified 1) | |
| (save-buffer)) |