Skip to content

Instantly share code, notes, and snippets.

View NewAlexandria's full-sized avatar
🍄
My responses are limited; you must ask the right questions.

NewAlexandria

🍄
My responses are limited; you must ask the right questions.
View GitHub Profile
@NewAlexandria
NewAlexandria / rub_bigdec_float.rb
Created January 13, 2012 17:03
Ruby comparison of BigDecimal vs. Float
# I've compiled this in order to test the speed on using a BidDecimal, which some in the community assert is slower than using a float.
# So far, it looks like BigDecimal is faster, and I've created this file to solicit feedback. Cheers.
run_size = 10000
p_fin = []
p_fin << "Each run #{run_size}"
t1 = Time.now
run_size.times do
r = BigDecimal.new
@NewAlexandria
NewAlexandria / rbenv_ree_install.sh
Created February 13, 2012 21:11
Installing Ruby Enterprise Edition into rbenv
########
# This file script wil show you how to install Ruby Enterprise Edition (REE) 1.8.7-2011-12 with
# rbenv, rails 3 and homebrew. Bundler is also used.
########
#setup the installer environment
brew install wget
wget -q http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.12.tar.gz
tar xzf ruby-enterprise-1.8.7-2011.12.tar.gz
@NewAlexandria
NewAlexandria / gemset_marhsalling.md
Created June 7, 2012 20:13
Marshaling Gemsets for Enterprise Gem Control

Problem Case

The situation arose where our Certifier gem would not bundle install Could not find gem 'rspec-core (= 2.5.1, runtime)' in any of the gem sources listed in your Gemfile.

Our gemserver (non-rubygems) only had

  • rspec-core-2.6.4.gem
  • rspec-core-2.8.0.gem

Analysis: someone had an old gem installed via rubygems, and didn't run bundle update when building the latest certifier. This used to be solved by maintaining the full-history of dependencies on our gemserver.

@NewAlexandria
NewAlexandria / DNA.md
Created November 28, 2012 20:14
Emoji art test

〰️ 〰️ 〰️ 〰️ 🔱 〰️ 〰️ 〰️ 〰️

〰️ 〰️ 〰️ 🔥 🌀 🍃 〰️ 〰️ 〰️

〰️ 〰️ 🔥 〰️ ☁️ 〰️ 🍃 〰️ 〰️

〰️ 〰️ 🔥 〰️ ⚡ 〰️ 🍃 〰️ 〰️

〰️ 〰️ 〰️ 🔥 🎶 🍃 〰️ 〰️ 〰️

@NewAlexandria
NewAlexandria / launchctl_with_bundle.xml
Last active December 10, 2015 06:18
A LaunchCtl template for calling a rails app mechanism via `bundle exec`
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.myapp</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
@NewAlexandria
NewAlexandria / mail_room.yml
Last active December 14, 2015 08:39
mail_room configuration experiments
---
:mailboxes:
-
:email: "my_gmail_user@gmail.com"
:password: "pasword"
:name: "inbox"
# :name: "BIZ/Career"
:delivery_method: logger
:log_path: "/var/www/rails/test_app/log/email.log"
# :delivery_url: "http://www.test_app.com/for/my_gmail_user/collect"
@NewAlexandria
NewAlexandria / alias_fixer.rb
Last active November 30, 2016 03:25
This script takes a directory of files ./A with broken aliases in ./A/B and fixes all those aliases by finding the associated file in ./[A-B] and calling `ln -sf`. It will not handle dir aliases, and can be confused when a the source tree contain multiple files with the target filename. As a bonus, this script will reduce the size of directories…
#!/usr/bin/env ruby
require 'fileutils'
# these are the folders containing all your images
if ARGV.size == 2
@NewAlexandria
NewAlexandria / svn_mass_conversion.rb
Created March 24, 2013 20:18
And then there was this time I had to mass-convert svn repos..
#!/usr/bin/env ruby
require 'fileutils'
path_base = ARGV[0] || '~/Sources'
server_path = ARGV[1]
repo_list = ARGV[2] || 'svn_repo_list'
svn_dir = File.expand_path File.join(path_base,'/svn')
git_dir = File.expand_path File.join(path_base,'/git')
unless File.exists? auth_file
@NewAlexandria
NewAlexandria / index.html
Created March 25, 2013 21:29 — forked from anonymous/index.html
Fork of AnonPen cloth demo in JS
<canvas id = "c" > </canvas>
<p>
Tear the cloth with your mouse.<br><br>
Right click and drag to cut the cloth.<br><br>
Reduce physics_accuracy if it's laggy, increase it for a better effect.
</p>
@NewAlexandria
NewAlexandria / selfie.rb
Created August 14, 2013 22:41
A file that reads from and writes to itself
#!/usr/bin/ruby
lines = IO.readlines($0) << (DATA.readlines << ARGV[0])
File.open($0, 'w') { |file| file.puts lines }
__END__