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 my-call (f n) | |
(funcall f n)) | |
(my-call #'1+ 5) ; => 6 | |
(my-call #'oddp 5) ; => t | |
(dolist (i (list 1 2 3)) | |
(my-call (lambda (x) (* i x)) 5))) ; prints 5 10 15 in lexical scoping |
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
;; in dynamic scoping | |
(defun my-compose (f g) | |
(lambda (x) | |
(funcall f (funcall g x)))) | |
(funcall | |
(my-compose (lambda (n) (+ n 3)) (lambda (n) (+ n 20))) | |
100) ; results in error, Lisp error: (void-variable f) |
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 'package) | |
(package-initialize) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(require 'auto-complete) | |
(require 'auto-complete-config) | |
(ac-config-default) | |
(add-to-list |
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
--regex-ruby=/(^|[:;])[ \t]*([A-Z][[:alnum:]_]+) *=/\2/c,class,constant/ | |
--regex-ruby=/(^|;)[ \t]*(has_many|belongs_to|has_one|has_and_belongs_to_many)\(? *:([[:alnum:]_]+)/\3/f,function,association/ | |
--regex-ruby=/(^|;)[ \t]*(named_)?scope\(? *:([[:alnum:]_]+)/\3/f,function,named_scope/ | |
--regex-ruby=/(^|;)[ \t]*expose\(? *:([[:alnum:]_]+)/\2/f,function,exposure/ | |
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2/f,function,aasm_event/ | |
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2!/f,function,aasm_event/ | |
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2?/f,function,aasm_event/ | |
--langdef=js | |
--langmap=js:.js |
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
$(document).ready(function() { | |
// get submenu index | |
var index = $('#submenu').attr('number'); | |
// show selected menu | |
selectedMenu(index); | |
}); |
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
# http://stackoverflow.com/questions/10375659/nginx-proxy-pass-node-ssl | |
server { | |
listen 443; | |
ssl on; | |
ssl_certificate newlocalhost.crt; | |
ssl_certificate_key newlocalhost.key; | |
server_name nodejs.newlocalhost.com; | |
add_header Strict-Transport-Security max-age=500; |
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 coursera | |
import scala.io.Source | |
import scala.util.Random | |
object RandomContraction extends App { | |
def readFile(path: String): Map[Int, List[Int]] = { | |
val f = Source.fromFile(path) |
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 coursera.dijkstra | |
import scala.io.Source | |
object ShortestPath extends App { | |
type Vertex = Int | |
type Weight = Long | |
type Edge = (Vertex, Weight) | |
type Graph = Vector[Vector[Edge]] |
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
example |
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
// doesn't work | |
compile 'com.mixpanel.android:mixpanel-android:4.4.0' | |
// work. Whyt?!?!?! | |
compile files('/Users/1002471/Library/Android/sdk/platforms/android-19/android.jar') | |