Skip to content

Instantly share code, notes, and snippets.

View wavebeem's full-sized avatar

Sage Fennel wavebeem

View GitHub Profile
#!/usr/bin/env ruby
require "nokogiri"
root = Nokogiri.parse(File.read("Empty.tmTheme"))
scopes = root
.css("plist dict array dict key")
.select {|key| key.text == "scope" }
.map {|key| key.next_element.text }
puts scopes
@wavebeem
wavebeem / main.js
Created April 20, 2015 16:58
99% mutation free, organic, non-GMO
var freeze = Object.freeze;
function array() {
return freeze([].slice.call(arguments));
}
function array_of_size(n) {
var xs = [];
while (n-- > 0) {
xs.push(null);
// I suppose my thinking here is that `into` could take either a Lo-Dash
// pipeline object or a function. It seems feasible, but I definitely can't
// speak to performance implications. It also assumes that `pipeline` doesn't
// need to be terminated and that `into` ends method chains.
var handle = _.pipeline()
.mapValues(s => s.toLowerCase())
.into(p => p.first.charAt(0) + p.last)
var jdalton = { first: "John-David", last: "Dalton" }
var bmock = { first: "Brian", last: "Mock" }
var people = [jdalton, bmock]
object ScalaJSExample extends js.JSApp{
def main() = {
val xs = Seq(1, 2, 3)
println(xs.toString)
val ys = Seq(4, 5, 6)
println(ys.toString)
val zs = for{
x <- xs
y <- ys
} yield x * y
import Data.List
data Coin = Coin Integer String
instance Show Coin where
show (Coin _ name) = name
currency =
[ Coin 25 "quarter"
, Coin 10 "dime"
public class Main {
public void foo() {
System.out.println("Foo!");
}
public static void main(String[] args) {
new Main().foo();
}
}
- W-s Create new stack below
- W-w Create new stack above
- W-d Create new column right
- W-a Create new column left
- WA-j Move window to stack below
- WA-k Move window to stack above
- WA-l Move window to column right
#import <Foundation/Foundation.h>
#define I(n) [NSNumber numberWithInt:(n)]
int
main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSArray *ary = [NSArray arrayWithObjects:
I(4), I(5), I(1), I(0), I(6), nil
];
#!/usr/bin/env ruby
#
# Ruby ruby ruby!
#
def fibo(a=1, b=1)
n = 0
yield 0, a
yield 1, b
loop do
a, b = b, a + b
-------------------- Brian Mock -----------------------
module Lab3 where
import List
-------------------- Problem 1 -----------------------
(==>) = flip ($)
integerToDigit (i + 1) = digits !! i