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
#include <stdio.h> | |
int main() | |
{ | |
int foo = 4; | |
if(1) { | |
int foo = 5; | |
printf("%i", foo); | |
} | |
printf("%i", foo); | |
} |
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
def test_config klass | |
var = klass.new | |
unless !var.respond_to?(:to_ary) && [var].flatten == [var] | |
puts "#{klass.name} is misbehaved" | |
end | |
end | |
class RespondToMissingTest | |
def respond_to_missing? method, *rest | |
if method.to_sym == :to_ary |
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
;; | |
;; NS CHEATSHEET | |
;; | |
;; * :require makes functions available with a namespace prefix. | |
;; | |
;; * :use makes functions available without a namespace prefix | |
;; (i.e., refers functions to the current namespace). | |
;; | |
;; * :import refers Java classes to the current namespace. | |
;; |
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
def render_message(template, phone) | |
url_split_thang = UrlShrotenerClient.tokenize(template) | |
url_split_thang.map do |obj| | |
if obj.url? | |
template = Liquid::Template.parse(obj.template) | |
edit(template).render(message_variable_values(phone), filters: [LiquidFilters]) | |
else | |
Liquid::Template.parse(obj.template).render... | |
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
(ns something.something | |
[:import [javax.xml.validation SchemaFactory Validator] | |
[javax.xml.transform.stream StreamSource]]) | |
(defn something [] | |
(let [factory (SchemaFactory/newInstance "http://www.w3.org/2001/XMLSchema") | |
file (clojure.java.io/file "simple.xsd") | |
schema (.newSchema factory file) | |
validator (.newValidator schema ) | |
stream-source (StreamSource. "simple-err.xml")] |
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
(ns something.something | |
[:import [javax.xml.validation SchemaFactory Validator] | |
[javax.xml.transform.stream StreamSource]]) | |
(defn something [] | |
(let [factory (SchemaFactory/newInstance "http://www.w3.org/2001/XMLSchema") | |
file (clojure.java.io/file "simple.xsd") | |
stream-source (StreamSource. "simple-err.xml"] | |
(-> (.newSchema factory file) | |
(.newValidator) |
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
(defn foo [a] a) | |
(defn foo | |
([a] a) | |
([a b] a)) | |
'(defn (foo a) a) | |
'(defn ((foo a) a) | |
((foo a b) a)) |
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
class Foo | |
def method_missing(*args) | |
puts("Called with: #{args.inspect}") | |
4 | |
end | |
end | |
class Bar < Foo | |
def respond_to?(*args) | |
super |
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
#!/bin/bash | |
#Fill these out, make sure there is no space immediately after the = signs | |
MOBILEDB_PATH=.... | |
SECURITY_SERVICES_PATH=.... | |
PSQL_USER=.... | |
#Upgrade Security Services | |
cd $SECURITY_SERVICES_PATH | |
git pull --ff-only |
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
(ns clojure-anagram.core | |
(:use [clojure [string :only [split-lines join]]])) | |
(def words (-> "/Users/you-will-never-guess/misc-src/anagram-jam/4000words.txt" | |
slurp | |
split-lines)) | |
(defn single-word-anagrams-for [word] | |
(let [normalized-word (sort word)] | |
(filter #(= (sort %) normalized-word) words))) |