Skip to content

Instantly share code, notes, and snippets.

View ignu's full-sized avatar
🏳️‍🌈
interested in: react/typescript rails/ruby elixir & graphql

Leonard Smith ignu

🏳️‍🌈
interested in: react/typescript rails/ruby elixir & graphql
View GitHub Profile
@ignu
ignu / gist:3286557
Created August 7, 2012 15:51
falling in love with keymando
map "<Cmd-Ctrl-p>" { Spotify.play_pause }
map "<Cmd-Ctrl-j>" { Spotify.next }
map "<Cmd-Ctrl-k>" { Spotify.previous }
map "<Cmd-Shift-m>" { activate("MacVim") }
map "<Cmd-Shift-b>" { activate("Google Chrome") }
only /iTerm/ do
map '<Cmd-w>', nil
map '<Cmd-q>', nil
@ignu
ignu / gist:5685418
Last active December 17, 2015 22:58
1) you don't need the var keyword. all variables will be protected from the global scope.
2) functions automatically return the last line, called an "explicit return"
3) functions are the funkiest looking but really simple. they look like this:
(obj) -> "this is my #{obj}"
instead of:
function(obj) {
return "this is my " + obj);
#!/usr/bin/env bash
# repository
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
# system update
yum -y update
yum -y groupinstall "Development Tools"
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick
@ignu
ignu / items.json
Last active August 29, 2015 13:56
{"items":[
{"name":"left-arrow","quantity":1,"repaint":false},
{"name":"right-arrow","quantity":1,"repaint":false},
{"name":"combo-left-thru","quantity":1,"repaint":false}] }
@ignu
ignu / composite_table_view.coffee
Last active August 29, 2015 14:01
CompositeTableView
@MyApp.module "Concerns", (Concerns, App, Backbone, Marionette, $, _) ->
Concerns.CompositeTableView =
template: "backbone/_concerns/templates/composite_table_view"
itemViewContainer: "tbody"
ui:
"headerRow" : "thead tr"
"actions" : ".actions"
"description" : ".description"
do (Backbone) ->
_sync = Backbone.sync
Backbone.sync = (method, entity, options = {}) ->
_.defaults options,
beforeSend: _.bind(methods.beforeSend, entity)
complete: _.bind(methods.complete, entity)
sync = _sync(method, entity, options)
if !entity._fetch and method is "read"
# doesn't work
# Error: /Users/ignu/code/true-app/spec/react-tests/log-activity-test.coffee:
# Cannot find module './log_activity' from '/Users/ignu/code/true-app/spec/react-tests/log-activity-test.coffee'
r = (path)->
jest.dontMock path
require path
r('./log_activity')
# totally works fine
jest.dontMock('./log_activity')
@ignu
ignu / cloudstack.java
Last active August 29, 2015 14:15
"snapshotshot 4"
private void handleException(Exception e) {
String[] error = e.getMessage().split("Error Code - ");
String errorMessage = error[0];
if (error.length == 2) { // error code has been supplied
int errorCode = Integer.parseInt(error[1]);
if (errorCode == 431) {
// ...
} else if (errorMessage.contains("Can't delete snapshotshot 4 due to it is not in BackedUp Status")) {
throw new EC2ServiceException(ClientError.IncorrectState, "Specified snapshot is not in the correct state 'completed' for deletion");
} else if (errorMessage.contains("Public key is invalid")) {
#!/bin/bash
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@ignu
ignu / data.csv
Last active August 29, 2015 14:27
data! from editdata.org!
cool o
oneaf adsf
af asdf