This file contains hidden or 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
| execute pathogen#infect() | |
| syntax on | |
| filetype on | |
| filetype plugin indent on | |
| let g:solarized_termcolors=256 | |
| let g:haskell_indent_case = 2 |
This file contains hidden or 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 string | |
| import nltk.data | |
| def reverse(sentence): | |
| return sentence[::-1] | |
| def stripped(sentence): | |
| return "".join(sentence.split()) | |
| def scrubbed(sentence): |
This file contains hidden or 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 'active_support/core_ext/string' | |
| class MyFakeActiveRecord | |
| def pluralized_table | |
| self.class.name.underscore.downcase.pluralize | |
| end | |
| def self.has_many(association) | |
| define_method(association) do | |
| "INNER JOIN #{association} ON #{association}.id = #{pluralized_table}.id" |
This file contains hidden or 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
| use std::thread; | |
| use std::sync::{Mutex, Arc}; | |
| struct Philosopher { | |
| name: String, | |
| left: usize, | |
| right: usize, | |
| } | |
| impl Philosopher { |
This file contains hidden or 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
| extern crate rand; | |
| use std::io; | |
| use std::cmp::Ordering; | |
| use rand::Rng; | |
| fn main() { | |
| println!("Guess the number!"); | |
| let secret_number = rand::thread_rng().gen_range(1, 101); |
This file contains hidden or 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
| defmodule MyList do | |
| def map([], _), do: [] | |
| def map([head | tail], func), do: [func.(head) | map(tail, func)] | |
| def sum([], total), do: total | |
| def sum([head | tail], total), do: sum(tail, head + total) | |
| def mapsum([], _), do: 0 | |
| def mapsum(list, func), do: sum(map(list, func), 0) | |
| end |
This file contains hidden or 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 Enumerable | |
| def self.classes | |
| ObjectSpace.each_object(Module).select { |m| m.include?(Enumerable) } | |
| end | |
| end | |
| module LambdaSugar | |
| require 'active_support' | |
| require 'active_support/core_ext/module' |
This file contains hidden or 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
| (use '[clojure.string :only (replace-first)]) | |
| (def body (atom (slurp "disintegration.txt"))) | |
| (def spaces #{\space \newline}) | |
| (defn strip-spaces [s] (remove #(spaces %) s)) | |
| (defn random-char [s] (rand-nth (strip-spaces s))) | |
| (defn delete-random-char [s] | |
| (replace-first s (random-char s) \space)) |
This file contains hidden or 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
| user=> (def foo (atom "foo")) | |
| #'user/foo | |
| user=> (swap! foo (fn [x] "bar")) | |
| "bar" | |
| user=> @foo | |
| "bar" |
This file contains hidden or 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
| <script type="text/javascript"> | |
| jQuery(function() { | |
| var $ = jQuery; | |
| var iframe = $('<iframe />', { | |
| src: 'http://disintegration.herokuapp.com', | |
| frameborder: 0, | |
| scrolling: "auto", | |
| width: 800, | |
| height: 3000 |