Skip to content

Instantly share code, notes, and snippets.

View avescodes's full-sized avatar

Avery Quinn avescodes

View GitHub Profile
puts "Welcome to uber-calculator"
puts "Please enter commands in the format:"
puts "\tX op Y"
puts "Prefix 0x for hex, 0b for binary"
puts "... hell, lets do octal too!"
puts "Type q(uit) to, y'know, QUIT!"
puts "Output in base 10, change output base with base = N"
class String
def to_10
@joshsusser
joshsusser / silence_assets.rb
Created April 17, 2012 22:34
put in config/initializers to silence asset logging in Rails development mode
if Rails.env.development?
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
call_without_quiet_assets(env)
ensure
;; borrowed from ibdknox/jayq
(defn map->js [m]
(let [out (js-obj)]
(doseq [[k v] m]
(aset out (name k) v))
out))
(defn clj->js
"Recursively transforms ClojureScript maps into Javascript objects,
other ClojureScript colls into JavaScript arrays, and ClojureScript

Things that suck about Sublime Text 2

This is a list I'm keeping of all the tiny little things that bother me about ST2 as I try to switch from vim.

These are nearly entirely shortcomings of Vintage.

The ones in bold are huge pains in the ass.

  1. Can't use counts with text objects: 3dap does the same thing as dap.

Ruby 1.9.3-p194 with DTrace probes, Perf Patches, and backported COW-friendly GC

Overview

This script installs a patched version of ruby 1.9.3-p194 with DTrace probes, boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Many thanks to funny-falcon for the performance patches and to Aaron Patterson for the DTrace instrumentation.

(ns react-cljs.core
(:require-macros [reactjs.macros :refer [pure]])
(:require React [reactjs.core :as r]))
(enable-console-print!)
(declare render-ui)
(defn render-counter [id state cb]
(pure state
(ns react-cljs.core
(:require React))
(declare render)
(defn handle-change [e]
(render {:text (.. e -target -value)}))
(defn render [{:keys [text]}]
(React/renderComponent
(ns echo-server
(:import (java.net InetAddress DatagramPacket DatagramSocket)))
(def udp-server (ref nil))
(def port 12345)
(defn localhost [] (. InetAddress getLocalHost))
(defn message [text]
@dylanmcdiarmid
dylanmcdiarmid / sexp-cheat-sheet
Created February 9, 2015 16:18
vim sexp mappings for normal people cheat sheet
.vimrc
" Map leader to comma
let maplocalleader=","
" Toggle this for vim-sexp to not go into insert mode after wrapping something
let g:sexp_insert_after_wrap = 0
" Toggle this to disable automatically creating closing brackets and quotes
let g:sexp_enable_insert_mode_mappings = 1
Vocab
@jasonrudolph
jasonrudolph / 00-about.md
Created September 21, 2012 18:42
Rough Notes from Strange Loop 2012