Ok, so the basic anatomy of a GitHub compare link is:
https://github.com/USER/REPO/compare/REF1...REF2
80.times{|a|p (0..300).map{|b|x=y=i=0;(x,y,i=x*x-y*y+b/150.0-1.5,2*x*y+a/40.0-1,i+1)until(x*x+y*y>4||i>98);i>98?0:1}*''} |
/** | |
* A proof of concept monkeypatch to make Cloud9 IDE work on a tablet. | |
* Since i'm an extremely lazy bastard I prepended this snippet directly in package/client/js/apf_release.js | |
* | |
* What does it do? | |
* - It fires a doubleclick for a 2-finger tap | |
* - It fires a mousewheel up / down event for a 2-finger swipe up / down. | |
* | |
* How does it work? | |
* Prepend the functions below to <cloud9>/package/client/js/apf_release.js, save, load in tablet. |
def clipboard | |
yield | |
pbcopy = IO.popen 'pbcopy', 'w' | |
$stdout = pbcopy | |
yield | |
ensure | |
pbcopy.close | |
$stdout = STDOUT | |
end | |
declare -r red=$'\e[31;40m' | |
declare -r blue=$'\e[0;34m' | |
declare -r d=$'\e[37;40m' # set this to what makes sense for your terminal color scheme | |
shopt -s histappend | |
pre_prompt() { | |
local exit_code=$?; | |
history -a; | |
history -n; |
$ whois microsoft.com | |
Whois Server Version 2.0 | |
Domain names in the .com and .net domains can now be registered | |
with many different competing registrars. Go to http://www.internic.net | |
for detailed information. | |
MICROSOFT.COM.ZZZZZZZZZZZZZZZZZZZZZZ.IS.A.GREAT.COMPANY.ITREBAL.COM | |
MICROSOFT.COM.ZZZZZZZZZZZZZZZZZZZ.GET.ONE.MILLION.DOLLARS.AT.WWW.UNIMUNDI.COM | |
MICROSOFT.COM.ZZZZZZZZZZZZZZZZZZ.IM.ELITE.WANNABE.TOO.WWW.PLUS613.NET |
GNU nano 2.0.6 File: tsa Modified | |
#!/bin/bash | |
# Run this script just before you put the laptop in the bin for security scanning. | |
# You can add the seconds the laptop will be waiting before speaking. The default | |
# is waiting for 180 seconds (3 minutes). | |
# Switch to the login screen, effectively locking the screen. | |
function lockscreen() { | |
/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend |
############################################################################ | |
# A more comprehensive drop-in replacement for Rails' internal link matcher regex | |
# which I invented from scratch... Oh yeah, Adderall is awesome. | |
# Takes about 40% longer to run than the stock auto_link regex in our test suite unfortunately :( | |
# but it accounts for pretty much EVERY linkable URI/URL, and is far more (in my opinion) | |
# readable and maintainable, due to its use of named groups/tokens. | |
# References used to build this: | |
# http://www.faqs.org/rfcs/rfc1738.html | |
# http://tools.ietf.org/html/rfc3986 | |
# http://en.wikipedia.org/wiki/URI_scheme << primary ref, was awesome, great diagram |
In many production systems you'll want to have one module capable of talking to many potential implementations of a collaborator module (e.g a in memory cache, a redis-based cache etc). While testing it's useful to control which module the module under test is talking to.
Here are the approaches I can see. The two points that seem to divide the approaches are their tool-ability (dialyzer) and their ability to handle stateful implementations (which need a pid
).
Modules are first class, so you can pass them in. Used in EEx, where passed module must implement a behaviour.
Find it here: https://github.com/bitemyapp/learnhaskell