Skip to content

Instantly share code, notes, and snippets.

View RobertLowe's full-sized avatar

Robert Lowe RobertLowe

View GitHub Profile
# robgleeson's fork much improved
class ErrorDelegate
attr_reader :pointer
alias_method :to_pointer, :pointer
def initialize
@pointer = Pointer.new_with_type '@'
end
@RobertLowe
RobertLowe / gist:1085832
Created July 16, 2011 00:25
Changes from ruby 1.9.2p180 -> 1.9.2p290
Sat Jul 9 19:25:02 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* ext/tk/extconf.rb: I gave up to fix the build issue of ext/tk with Windows
installer (mingw32). Ported whole ext/tk/extconf.rb from trunk.
Mon Jul 4 00:28:05 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* ext/tk/extconf.rb (find_tcl): fixed a TypeError on --with-opt-dir.
reported by luislavena and ksmakoto.
@RobertLowe
RobertLowe / gist:2065750
Created March 17, 2012 22:08
Load a Chef::Node and convert it to an actual Node object
# load a chef node and turn it into an actual node object
node = Chef::Node.load("xxxx") # returns a hash
node = Chef::Node.new.tap do |n|
n.name( node["name"] )
n.chef_environment( node["chef_environment"] )
n.run_list( node["run_list"])
n.normal_attrs = node["normal"]
n.default_attrs = node["default"]
@RobertLowe
RobertLowe / yaml.rb.diff
Created April 26, 2012 19:41
No, you shutta-upa
diff a/lib/yaml.rb b/lib/yaml.rb
--- a/lib/yaml.rb
+++ b/lib/yaml.rb
@@ -57,9 +58,6 @@
require 'psych'
engine = 'psych'
rescue LoadError
- warn "#{caller[0]}:"
- warn "It seems your ruby installation is missing psych (for YAML output)."
- warn "To eliminate this warning, please install libyaml and reinstall your ruby."
@RobertLowe
RobertLowe / ubuntu-12.04-lts.erb.sh
Created April 26, 2012 20:31
chef ubuntu 12.04 LTS bootstrap
bash -c '
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get -y upgrade
apt-get install -y build-essential wget zlib1g-dev libssl-dev libffi-dev libncurses-dev libreadline-dev libyaml-dev libffi6 libssl0.9.8
wget https://s3.amazonaws.com/dev.ops/ruby-1.9.3-p194-perf_without_psych_no_warnings_amd64.deb
dpkg -i ruby-1.9.3-p194-perf_without_psych_no_warnings_amd64.deb
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.23.tgz
@RobertLowe
RobertLowe / json
Last active January 6, 2018 23:15
IBM EoD 2014->2016
[ {
"date": "2014-01-02T14:30:00.000Z",
"open": 187.2100067138672,
"low": 185.1999969482422,
"high": 187.39999389648438,
"close": 185.52999877929688,
"volume": 4546500
}, {
"date": "2014-01-03T14:30:00.000Z",
"open": 185.8300018310547,
@RobertLowe
RobertLowe / mango.md
Created March 9, 2018 14:46
Meteor <-> Mongo, positional operator caution

This is poor behaviour from Mongo, and sorta fixed in 3.6 via the $[] operator (which is coming in Meteor 1.6.2), you should verify your apps aren't effected

But, $ probably isn't working as expected (in some cases)

$ | Acts as a placeholder to update the first element that matches the query condition.

https://docs.mongodb.com/manual/reference/operator/update-array/#update-operators

Docs are correct, but consider this example:

@RobertLowe
RobertLowe / resolving.js
Created March 14, 2018 03:29
Stop using async with Meteor. Futures are the future (still).
// Go forth and code with the simplicity of sync
//
// PSA: this isn't production ready, and just a PoC, but enjoy using it!
// server only, as we need fibers (co-routines)!
import Future from 'fibers/future';
let resolving = (object, operation, ...args)=>{
let future = new Future();
@RobertLowe
RobertLowe / README.md
Last active April 6, 2018 21:50
forceFinderBoundsAndPosition.scpt

Force Finder Bounds and Position - Stay boy stay!

Create files below and and load:

launchctl load ~/Library/LaunchAgents/com.you.forceFinder.plist

Enjoy Finder windows with a static position and size! Adjust to your personal preferences.

Stay in place finder

@RobertLowe
RobertLowe / list.txt
Created September 27, 2018 05:38
twitch.tv all non-automated tags
100%
3D Modeling
3D Printing
Achievement Hunting
Action
Adventure
Adventure Game
All pick
AMA
Animals