Skip to content

Instantly share code, notes, and snippets.

@staltz
staltz / introrx.md
Last active May 15, 2025 10:37
The introduction to Reactive Programming you've been missing
@attentive
attentive / leaflet-helloworld.cljs
Last active August 29, 2015 14:00
LeafletJS Hello World in Om and ClojureScript
(ns leaflet-helloworld
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(defn map-view [_ owner]
(reify
om/IRender
(render [_]
(dom/div #js {:id "the-map"} nil))
om/IDidMount
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active May 19, 2025 18:08
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@allgress
allgress / reagent_datascript.cljs
Last active February 16, 2023 21:16
Test use of DataScript for state management of Reagent views.
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))
@javouhey
javouhey / gist:9234850
Last active August 29, 2015 13:56
#golang Stupid mistakes newbies make
// A. Cannot use type switch outside of a switch statement
type PolarVortex interface {}
func main() {
var p PolarVortex = new(PolarVortex)
var s = p.(type) // compilation error => use of .(type) outside type switch
}
@willurd
willurd / web-servers.md
Last active May 18, 2025 17:06
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@heygarrett
heygarrett / vimrc
Last active September 6, 2019 07:02
Solarized: Night & Day
" Set colorscheme to solarized
colorscheme solarized
" Change the Solarized background to dark or light depending upon the time of
" day (5 refers to 5AM and 17 to 5PM). Change the background only if it is not
" already set to the value we want.
function! SetSolarizedBackground()
if strftime("%H") >= 5 && strftime("%H") < 17
if &background != 'light'
set background=light
@thijsc
thijsc / gist:1391107
Created November 24, 2011 11:08
Select item from chosen js select with Capybara and Selenium
def select_from_chosen(item_text, options)
field = find_field(options[:from])
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()")
page.execute_script("$('##{field[:id]}').val('#{option_value}')")
end
@foca
foca / value_object.rb
Created July 30, 2011 02:14
Extremely lightweight "Struct" that only defines attribute readers
module ValueObject
def self.new(*attrs)
klass = Class.new(Object)
klass.send(:attr_reader, *attrs)
klass.send(:define_method, :initialize) do |*args|
raise ArgumentError, "wrong number of arguments (#{args.size} for #{attrs.size})" unless args.size == attrs.size
attrs.each_with_index do |attr, idx|
instance_variable_set("@#{attr}", args[idx])
@taf2
taf2 / load.patch
Created June 5, 2011 13:05
Ruby 1.9.2-p180 require performance patch
--- a/load.c 2010-10-23 05:36:38.000000000 -0400
+++ b/patchload.c 2011-06-05 08:58:00.000000000 -0400
@@ -40,14 +40,6 @@
VALUE ary;
long i;
- for (i = 0; i < RARRAY_LEN(load_path); ++i) {
- VALUE str = rb_check_string_type(RARRAY_PTR(load_path)[i]);
- if (NIL_P(str) || !rb_is_absolute_path(RSTRING_PTR(str)))
- goto relative_path_found;