This file contains 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
require 'rubygems' | |
require 'nokogiri' | |
require 'httparty' | |
doc = Nokogiri(HTTParty.get('http://www.gutenberg.org/wiki/Harvard_Classics_(Bookshelf)')) | |
ids = doc.css('a').select{|a| a.attr('title') =~ /ebook:/ }.map do |a| | |
a.attr('title') =~ /ebook:(\d+)/ | |
{:title => a.text, :id => $1 } | |
end.compact.uniq |
This file contains 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 :_exit, :exit | |
def exit(*args, &blk) | |
puts "EXIT CALLED BY #{caller.inspect} #{args.inspect}" | |
_exit(*args, &blk) | |
end | |
end |
This file contains 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
Date.today.strftime('%-m%-d%y') # 3242013 | |
Date.strptime('3242013','%-m%-d%y') # ArgumentError: invalid date |
This file contains 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
diff --git a/vimrc.bundles b/vimrc.bundles | |
index 9e9a983..829977c 100644 | |
--- a/vimrc.bundles | |
+++ b/vimrc.bundles | |
@@ -32,6 +32,7 @@ Bundle 'tpope/vim-unimpaired' | |
Bundle 'tpope/vim-vividchalk' | |
Bundle 'uarun/vim-protobuf' | |
Bundle 'vim-ruby/vim-ruby' | |
+Bundle 'vim-scripts/align.vim' | |
Bundle 'vim-scripts/greplace.vim' |
This file contains 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
#include <string.h> | |
#include <stdio.h> | |
#include <zmq.h> | |
#include <assert.h> | |
int main (int argc, char ** archv) { | |
void * context = zmq_init(1); | |
void *socket = zmq_socket (context, ZMQ_SUB); | |
assert (socket); |
This file contains 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 ruby | |
staged_files = Array(`git diff --name-only --cached`.split("\n")) | |
puts "staged files are: #{staged_files}" | |
staged_files.each do |file| | |
sha_to_fixup = `git log -n1 --format=%h #{file}`.gsub(/\s*/, '') | |
# assert sha has not been merged | |
fail "no commit to fixup in this topic branch" if `git branch --contains #{sha_to_fixup}`.split("\n").any? { |branch| branch =~ /\s*master\s*/ } | |
puts sha_to_fixup | |
`git commit --fixup #{sha_to_fixup}` |
This file contains 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 ChordSpeller = { | |
chord: {}, // this represents the cord the user is holding down. map[string] -> int | |
chordView: null, // cached chord view | |
self: this, | |
init: function() { | |
console.log("requesting MIDI access"); | |
if (navigator.requestMIDIAccess) { | |
navigator.requestMIDIAccess({ | |
sysex: false | |
}).then(ChordSpeller.onMIDISuccess, ChordSpeller.onMIDIFailure); |
This file contains 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 ChordSpeller { | |
constructor(chordView) { | |
if (this.chordView === null) { | |
alert("no chordview accessible"); | |
} | |
this.chord = {}; | |
this.scope = this; | |
} | |
This file contains 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 dotspacemacs/user-config () | |
(setq org-capture-templates (quote (("tw" "to do [WORK]" entry (file+headline "~/Dropbox/org/work.org" "Work Todo") | |
"* TODO %^{Brief description} %^G | |
%? | |
SCHEDULED: %t | |
%a | |
")))) | |
) |
This file contains 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
package main | |
import "k8s.io/kubernetes/pkg/labels" | |
func main() { | |
_, err := labels.Parse(labels.Nothing().String()) | |
if err != nil { | |
panic("test failure") | |
} | |
} |
OlderNewer