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
[ | |
{ "keys": ["super+shift+x"], "command": "tidy_xml" }, | |
{ "keys": ["super+shift+j"], "command": "prettify_json" } | |
] |
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
// Style the line numbers, instead of a tiny sliver | |
.editor .gutter .line-number.git-line-modified { | |
border-left: none; | |
padding-left: none; | |
color: #b58900; | |
} | |
.editor .gutter .line-number.git-line-removed { | |
border-left: none; | |
padding-left: none; |
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 page = require('webpage').create(); | |
var url = "http://nope"; | |
page.onResourceReceived = function(resource) { | |
console.log('Url: ' + resource.url); | |
console.log('Code: ' + resource.status); | |
} | |
page.open(url, function(status) { |
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
def foo | |
puts "something" | |
end | |
def bar | |
puts "something else" | |
end | |
#current | |
def pull | |
transaction_successful?.tap do |success| |
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
#xmpfilter in Sublime Text 2 | |
#Install "Ruby Markers" sublime plugin | |
#also "gem install rcodetools" (includes xmpfilter) | |
#Preferences->Package Settings->Ruby Markers->Settings User: | |
#{ | |
# "check_for_rvm": true, | |
# "strip_stdout": true | |
#} | |
#To evaluate: |
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
#solution for "Get this code to pass RSpec" | |
require 'rspec' | |
class Object | |
def should(*args);end | |
def should_not(*args);end | |
def method_missing(method,*args) | |
if method == :upcase | |
Object.new |
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
function pull_commands() { | |
#get all projects | |
project_name_hash_id_map=$(curl -sS -X GET "https://semaphoreapp.com/api/v1/projects?auth_token=${SEMAPHORE_API_TOKEN}" | jq '[.[] | {(.name): .hash_id}] | add') | |
if [ -z "$project_name_hash_id_map" ] | |
then | |
echo "projects call failed" | |
exit 1 | |
fi | |
#for each project, get the hash_id of each project |
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
#Stream output and capture it and exit status as well | |
require 'open3' | |
output = '' | |
exit_status = nil | |
Open3.popen2e('foobarwhat') {|stdin, stdout_and_stderr, wait_thread| | |
stdout_and_stderr.each{|line| | |
puts line | |
output += line |
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 | |
set -e | |
source "$HOME/.rvm/scripts/rvm" #so 'cd' will change gemset when dotfiles present | |
#setup | |
rm -rf ~/tmp/dir_with_gemfile | |
mkdir -p ~/tmp/dir_with_gemfile | |
echo "source 'https://rubygems.org'" > ~/tmp/dir_with_gemfile/Gemfile |
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
Array.prototype.map = function(f) { | |
res = new Array(this.length); | |
for (i=0;i < this.length; i++) { | |
res[i] = f(this[i]); | |
} | |
return res; | |
}; | |
new_a = [1,2,3,4].map(function(ele){ return ele*2; }); | |
console.log("new_a: "+new_a); |
OlderNewer