Skip to content

Instantly share code, notes, and snippets.

@barik
barik / gist:974314
Created May 16, 2011 11:52
Haskell Example
doubleMe x = x + x
doubleUs x y = doubleMe x + doubleMe y
doubleSmallNumber x =
if x > 100
then x
else x * 2
maximum' [] = error "Empty list"
maximum' [x] = x
@barik
barik / gist:1297147
Created October 19, 2011 00:20
distribute-install
== Installing Distribute...
!! If you get a permissions error in the "After install bootstrap"
section, ignore it. It will still work.
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.24.tar.gz
Extracting in /tmp/tmpP52nRy
Now working in /tmp/tmpP52nRy/distribute-0.6.24
Installing Distribute
Before install bootstrap.
Scanning installed packages
@barik
barik / gist:2314395
Created April 5, 2012 21:39
gem install rails issue
[barik@tango ~]$ gem install rails
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
@barik
barik / gist:2669783
Created May 13, 2012 00:04
Dropbox Answer Guide
---------------------------Dropquest 2012 Answer Guide-----------------------------
Chapter 1: 64529 38645 46637 24929 <- try one of these
Chapter 2: https://www.dropbox.com/dropquest2012/crane
Chapter 3: SMUDGES
Chapter 4: SOMA
Chapter 5: MAD LIB
Chapter 6: https://www.dropbox.com/events?ns...=3-21-2005 or https://www.dropbox.com/events?ns...d=1-7-2003
Chapter 7: https://www.dropbox.com/dropquest2012/LEADING or https://www.dropbox.com/dropquest2012/DEALING or https://www.dropbox.com/dropquest2012/ALIGNED
Chapter 8: triumphant
Chapter 9: Go https://www.dropbox.com/tour/6 and invite the given email address
@barik
barik / gist:2722709
Created May 18, 2012 02:02
Player Score Perception
[1] "WON MORE TURNS"
won_more_turns
p1_units Agree Disagree Neither agree nor disagree Strongly agree Strongly disagree
3 14 6 15 0 0
5 9 3 8 3 1
Fisher's Exact Test for Count Data
data: dwonmoret.con
p-value = 0.1775
0 1 2 3 4 5
P120 2 1 10 11 0 0
P249 0 1 6 17 0 0
P356 2 0 11 11 0 0
P488 0 0 11 12 1 0
P597 0 12 0 0 11 1 <-- hmm
P748 2 1 9 11 0 1
> d5.rat
0 1 2 3 4 5
d5.rat 31 203 244 297 184 25
0 328 164 164 328 0
> chisq.test(d5.rat)
Pearson's Chi-squared test
data: d5.rat
X-squared = 179.9828, df = 5, p-value < 2.2e-16
@barik
barik / gist:3020734
Created June 29, 2012 21:24
java magic
c:\Windows\System32>dir java.exe
Volume in drive C is Windows7_OS
Volume Serial Number is 8ACF-6025
Directory of c:\Windows\System32
06/25/2012 10:35 PM 188,840 java.exe
1 File(s) 188,840 bytes
0 Dir(s) 164,390,166,528 bytes free
@barik
barik / gist:3057703
Created July 6, 2012 02:31
Emacs Buffer Change Mode
(setq default-major-mode (lambda ()
(let ((buffer-file-name
(or buffer-file-name (buffer-name))))
(set-auto-mode))))
(global-set-key "\C-cl" 'org-store-link)
(define-key global-map "\C-cc" 'org-capture)
http://stackoverflow.com/questions/906368/what-is-the-difference-between-global-set-key-and-define-key-global-map-in-e