Links and Notes from my Classy Git RubyConf talk:
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 | |
status = DATA.flock(File::LOCK_EX | File::LOCK_NB) | |
if status == 0 | |
puts "we have the lock..." | |
sleep | |
else |
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
@Test | |
public void dumpEnv() { | |
for (Map.Entry<String, String> entry : new TreeMap<String, String>(System.getenv()).entrySet()) { | |
System.out.println(entry); | |
} | |
} |
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 S; def initialize *w; @s=w; end; def method_missing *w;@s<<w;self;end;def | |
to_ary;[@s.map{ |e| e=~/[\,\.\:\-\(\)\/\'\"]/?[e]:[" ",e] }.join.strip];end;end | |
def Object.const_missing(c);S.new c;end; ###### https://gist.github.com/2354740 | |
puts This.is.a.sentence.represented.by.a.Ruby.expression(",").try.it.out! ##### |
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
;; emacs configuration | |
(push "/usr/local/bin" exec-path) | |
(add-to-list 'load-path "~/.emacs.d") | |
(setq make-backup-files nil) | |
(setq auto-save-default nil) | |
(setq-default tab-width 2) | |
(setq-default indent-tabs-mode nil) | |
(setq inhibit-startup-message t) |
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
#!/Users/moss/.rvm/rubies/ruby-1.9.2-p320/bin/ruby | |
class Runner | |
def initialize basepath, executor = ExecutionService.new | |
@basepath = basepath | |
@executor = executor | |
@cmds_term = TmuxSession.new '0', executor | |
@test_term = TmuxSession.new '1', executor | |
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
#!/usr/bin/env python | |
""" | |
This script recursively searches the current directory for .vimrc files | |
and counts the number of times an option has been modified. | |
It currently only uses lines that start with 'set ', 'setlocal', 'let', | |
etc. are ignored. | |
""" |
A small sampling of external projects initially built for Ember use but designed to be used standalone:
- Handlebars - templating engine
- simple-html-tokenizer - an HTML5 tokenizer
- HTMLBars - alternate HTML-aware Handlebars backend
- morph - text-node placeholders for data binding systems
- RSVP - fast, lightweight promise library
- route-recognizer - just the recognition part of a router
- router.js - hierarchical states and transition-based router
- dag-map - graph library
What is the simplest Go scoring system? It's this:
- Stone Scoring: just count the stones on the board
At the end of the game, both players will want to fill in as much of their own territory as they can, while allowing two eyes per group (so they aren't captured). Then the winner is just the player with more stones on the board. Note that prisoners are not counted.
But nobody wants to play all these extra stones at the end. So we can instead use:
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
SIZE = -> coll { | |
coll == [] || coll == '' ? 0 : 1 + SIZE[coll[1..-1]] | |
} | |
MAP = -> coll, &fn { | |
coll == [] ? [] : [fn[coll[0]]] + MAP[coll[1..-1], &fn] | |
} | |
KEYS = -> hash { MAP[[*hash], &-> h { h[ 0] }] } | |
VALUES = -> hash { MAP[[*hash], &-> h { h[-1] }] } |
OlderNewer