Skip to content

Instantly share code, notes, and snippets.

View tonini's full-sized avatar
💭
I may be slow to respond.

Samuel Tonini tonini

💭
I may be slow to respond.
View GitHub Profile

Cheat Sheet

There is a cheat-sheet available of the default set keystrokes which cabbage comes with.

Convert a GitHub Issue Into a Pull Request
A little-known-feature of the GitHub API is the ability to attach changes to an issue, converting it into a pull request. The hub command, a wrapper around git that makes it more GitHub aware, allows you to easily do this.
hub pull-request -i 384 -b bkeepers:master -h bkeepers:branch-name
-i is the GitHub issue number
-b is the base, or where you want to send the pull request, with bkeepers being the owner of the repository.
-h is the head, or the branch where your changes live.
Update: in the comments, George Hickman suggests: “as long as you’ve pushed your changes and your local branch is tracking your remote you can exclude the -b and -h options!”. Note that you can set up tracking when pushing with git push -u origin branch-name.
[format]
pretty = %C(yellow)%h%Creset%C(green)%d%Creset %s %C(red)[%an]%Creset %C(cyan)[%cr]%Creset
@tonini
tonini / unit.js
Last active December 22, 2015 17:19
# karma config file
module.exports = function(config) {
config.set({
basePath: __dirname + '../../../',
frameworks: ['jasmine'],
browsers: ['PhantomJS'],
reporters: ['dots'],
autoWatch: false,
#!/bin/bash
#
# god Startup script for God monitoring tool.
#
# chkconfig: - 85 15
# description: god monitors your system
#
CONF_DIR=/var/www/<project>/config/unicorn_god.rb
PID=/var/run/god.pid
context = describe
before = beforeEach
describe "LockIconToggleCtrl", ->
beforeEach(angular.mock.module("test"))
scope = {}
ctrl = {}
@tonini
tonini / user_test.rb
Last active December 24, 2015 14:59
class ActiveSupport::TestCase
class << self
remove_method :describe
alias :context :describe
end
extend MiniTest::Spec::DSL
end
(ert-deftest test-flatten-of-list ()
(should (equal (elixir-mix-flatten '(1 2 (3 4) 5))
'(1 2 3 4 5)))
(should (equal (elixir-mix-flatten '(1 2 ("wood" "fire" (3)) 4 5))
'(1 2 "wood" "fire" 3 4 5))))
(defun elixir-mix-flatten (alist)
(cond ((null alist) nil)
((atom alist) (list alist))
(t (append (elixir-mix-flatten (car alist))
(elixir-mix-flatten (cdr alist))))))
(ert-deftest test-flatten-of-list ()
(should (equal (elixir-mix-flatten '(1 2 (3 4) 5))
'(1 2 3 4 5)))
(should (equal (elixir-mix-flatten '(1 2 ("wood" "fire" (3)) 4 5))
(defun karma-project-root ()
(let ((file (file-name-as-directory (expand-file-name default-directory))))
(karma--project-root-identifier file karma--project-root-indicators)))
(defun karma--project-root-identifier (file indicators)
(let ((root-dir (if indicators (locate-dominating-file file (car indicators)) nil)))
(cond (root-dir (directory-file-name (expand-file-name root-dir)))
(indicators (karma--project-root-identifier file (cdr indicators)))
(t nil))))