Skip to content

Instantly share code, notes, and snippets.

View jimsynz's full-sized avatar
💜

James Harton jimsynz

💜
View GitHub Profile
{{description}}
def bytecode g
pos g
g.push_rubinius
g.create_block block_from_children g
g.send_stack_with_block :lambda, 0
g.ret
end
!RBIX
3820501463222725467
0
M
1
n
n
n
i
19
@jimsynz
jimsynz / kstruct.rb
Created August 25, 2014 22:27
Struct using keyword args (actually, really just a hash).
class KStruct
def self.new *attr_names
Class.new(Struct) do
attr_accessor *attr_names
end
end
class Struct
def initialize args
[08:27][jnh@Bucket]~$ brew upgrade -v gdk-pixbuf
==> Upgrading 1 outdated package, with result:
gdk-pixbuf 2.30.8
==> Upgrading gdk-pixbuf
rm /usr/local/bin/gdk-pixbuf-csource
rm /usr/local/bin/gdk-pixbuf-pixdata
rm /usr/local/bin/gdk-pixbuf-query-loaders
rm /usr/local/include/gdk-pixbuf-2.0
rm /usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.la
rm /usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.so
module AssetsHelper
def inline_asset name
Rails.application.assets.find_asset(name).source
end
end
Fetching: https://rubygems.org/specs.4.8.gz
Total gems: 505858
Fetching 94 gems
....404 on application_seeds-0.1.0.gem
......404 on dwradcliffe_test_gem_push-0.0.4.gem
....404 on good-0.1.2.gem
.........404 on filelock-1.0.2.gem
..................404 on picasawebalbums-1.4.6.gem
.....................................................Deleting 0 gems
@jimsynz
jimsynz / auto_confirm.patch
Created January 10, 2015 20:55
Patches for the RailsCamp GitLab Vagrant box.
--- user.rb.orig 2015-01-10 20:53:40.369172619 +0000
+++ user.rb 2015-01-10 19:16:38.650782073 +0000
@@ -180,6 +180,8 @@
scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM members)') }
scope :potential_team_members, ->(team) { team.members.any? ? active.not_in_team(team) : active }
+ after_create :confirm!
+
#
# Class methods
# Never forward addresses in the non-routed address spaces.
bogus-priv
# Filter useless windows-originated DNS requests.
filterwin2k
# Drop privileges from root to this user and group.
user=dnsmasq
group=nogroup
# By default, dnsmasq binds the wildcard address, even when only listening on
@jimsynz
jimsynz / enumerable_skip.rb
Last active August 29, 2015 14:20
Duck punch `skip` into `Enumerable` because it should have it.
module Enumerable
# Duck punch for Enumerable that adds skip() to bypass
# the first `n` elements of the enumerator.
# Use skip/take to retrieve a range of values from an enumerable
# without forcing the values into an array and using [].
#
# This is substantially faster for really big collections, but
# not so much for small ones. ie use at your own risk
# Also, skip provides superficially the same behaviour as drop,