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 app = angular.module('app', []); | |
app.controller('TodoCtrl', function($scope) { | |
$scope.foo = true; | |
$scope.bar = false; | |
$scope.baz = true; | |
$scope.baa = true; | |
$scope.checkboxes = { | |
'foo': $scope.foo, | |
'bar': $scope.bar, |
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
import java.io.BufferedReader; | |
import java.io.StringReader; | |
import java.util.HashMap; | |
public class CSVMapper { | |
public String transformCsv (String csvFile) { | |
return csvMapToString(getCsvMap(csvFile)); | |
} | |
private HashMap<String, Integer[]> getCsvMap (String csvFile) { |
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 Main where | |
main = undefined |
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
<span class="foo">bar</span> |
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.exports = function(grunt) { | |
grunt.initConfig({ | |
foo: { | |
bar: { | |
options: {} | |
} | |
} | |
}) | |
grunt.loadTasks('tasks') |
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
;;;; Partial Tail Call Optimization in Clojure | |
;; See this for why no full implicit TCO: https://groups.google.com/forum/#!msg/clojure/4bSdsbperNE/tXdcmbiv4g0J | |
; Naive non-optimized tail-recursive factorial function | |
(defn naive-factorial | |
([n] (naive-factorial n 1)) | |
([n acc] | |
(if (zero? n) | |
acc | |
(naive-factorial (- n 1) (* acc n))))) |
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
(defn callfn [f & args] | |
(apply f args)) | |
(callfn + 1 2 3 4) | |
; returns 10 |
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
mkfifo mypipe; nc -l 8089 < mypipe | tee inflow | nc www.google.com 80 | tee outflow > mypipe; rm mypipe |
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 GHCi | |
:set +m | |
let x y = x y | |
-- ex: x 2 will loop infinitely | |
:{ | |
let { | |
z y = y | |
where | |
t = x 2 |
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 items = ['Cheese, blue', 'Cheese, cheshire', 'Avocadoes, raw']; | |
$('.food-input').keyup(function(event) { | |
if (event.key.match(/^[a-zA-Z0-9, -]{1}$/g)) { | |
var inputVal = event.target.value; | |
var match = items.filter(function(item) { | |
return item.match(new RegExp('^'+ inputVal +'.*', 'g')); | |
}); | |
if (match.length > 0) { | |
event.target.value = match[0]; |
OlderNewer