Skip to content

Instantly share code, notes, and snippets.

View coldnebo's full-sized avatar

Larry Kyrala coldnebo

View GitHub Profile
@coldnebo
coldnebo / example.rb
Created May 7, 2012 11:49
trying to SimpleDelegator an AREL object
# based on http://tatey.com/2012/02/07/mocking-with-minitest-mock-and-simple-delegator/
class Order < ActiveRecord::Base
# …
end
class MyController < ApplicationController
def index
@orders = Order.find(:all)
end
@coldnebo
coldnebo / bday.rb
Created June 25, 2012 14:39
a set of diophantine equations relating father and son...
# Interesting relationships:
# Say the father's age is 72 and the son's age is 40.
# The father was born in 1940 and the son in 1972.
# Isn't that curious?
# In english, the dad's age is the current year minus the dad's birth year,
# the right-most 2 digits of the dad's birth year is the son's age,
@coldnebo
coldnebo / local_tracer_patch.rb
Created July 9, 2012 17:23
unroller replacement for rails...
# to be used only for local debugging
LK_ENABLE_TRACE = false
if LK_ENABLE_TRACE && Rails.env.development?
require 'thread'
class LkTracer
def initialize
@coldnebo
coldnebo / Gemfile
Last active December 21, 2015 00:08
files for reproduction of Bundler issue #2593 -- https://github.com/bundler/bundler/issues/2593
source 'https://rubygems.org'
gemspec
@coldnebo
coldnebo / arma2.bat
Last active December 22, 2015 13:49
ARMA stuff
set "STEAMHOME=F:\games\steam\steamapps\common"
rem =========================== mods =========================
rem Latest mod versions as of 10/16/2013:
rem CBA*: Community Base Addons CBA_v1.0.0pre10.7z: http://dev-heaven.net/attachments/download/19512/CBA_v1.0.0pre10.7z
rem ASR_AI: Improved AI @ASR_AI_v1_16_1.7z: http://www.armaholic.com/page.php?id=12105&a=dl
rem ACEX_SM: Improved Sound Effects @ACEX_SM_v1.13.0.100.7z: http://www.armaholic.com/page.php?id=12160&a=dl
rem Blastcore: Better Explosions @Blastcore_Visuals_R1.2.rar: http://www.armaholic.com/page.php?id=12975&a=dl
rem sthud: Situational Awareness 121209_sthud_islandfree.7z: http://www.armaholic.com/page.php?id=9936&a=dl
@coldnebo
coldnebo / Default (Linux).sublime-keymap
Created July 5, 2011 20:12
simple script to checkout files with perforce while in sublime text 2
[
{ "keys": ["f8"], "command": "p4_edit" }
]
@coldnebo
coldnebo / bashrc_functions.sh
Last active February 6, 2016 20:16
how I manage my paths
pathadd() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="${PATH:+"$PATH:"}$1"
fi
}
pathoverride() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="$1${PATH:+":$PATH"}"
fi
@coldnebo
coldnebo / error.sh
Created August 31, 2011 19:54
[FIXED] ruby encodings... can we word this error differently?
$ irb
ruby-1.9.2-p180 :001 > "“"
=> "“"
ruby-1.9.2-p180 :002 > "“".encoding
=> #<Encoding:UTF-8>
ruby-1.9.2-p180 :003 > "\“"
SyntaxError: (irb):7: invalid multibyte char (UTF-8)
(irb):7: invalid multibyte char (UTF-8)
from /local/rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'
{
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"font_size": 11,
"ignored_packages":
[
"Vintage"
],
"tab_size": 2,
"translate_tabs_to_spaces": true,
"hot_exit": false,
@coldnebo
coldnebo / rubyvm.patch
Created May 3, 2017 15:32
fix for compile issue encountered in https://github.com/rvm/rvm/issues/4000
diff --git a/random.c b/random.c
index e669e98..9334921 100644
--- a/random.c
+++ b/random.c
@@ -521,7 +521,7 @@ fill_random_bytes_syscall(void *seed, size_t size, int unused)
CryptGenRandom(prov, size, seed);
return 0;
}
-#elif defined __linux__ && defined SYS_getrandom
+#elif defined __linux__ && defined __NR_getrandom