Skip to content

Instantly share code, notes, and snippets.

@craigmcnamara
craigmcnamara / odd_regex result.md
Last active August 29, 2015 14:13
JRuby Regex Strangeness

Setup

Given this method calling to Compass::SpriteImporter.path_and_name and patched to raise an exception

Compass::SassExtensions::Sprites::SpriteMap.class_eval do
  def self.from_uri(uri, context, kwargs)
    uri = uri.value
    path, name = Compass::SpriteImporter.path_and_name(uri)
 raise "Path: #{path} Name: #{name} URI: #{uri} CallReturn: #{Compass::SpriteImporter.path_and_name(uri)}"

Keybase proof

I hereby claim:

  • I am craigmcnamara on github.
  • I am craigmcnamara (https://keybase.io/craigmcnamara) on keybase.
  • I have a public key whose fingerprint is 06BC 4E54 23B6 18CC 6FCF 90E4 CAD6 C07B 31E3 7C6D

To claim this, I am signing this object:

function vote_poll() {
global $wpdb, $user_identity, $user_ID;
if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'polls')
{
// Load Headers
polls_textdomain();
header('Content-Type: text/html; charset='.get_option('blog_charset').'');
// Get Poll ID
@craigmcnamara
craigmcnamara / Compass Railtie
Last active December 30, 2015 05:39
Railtie for a Gem that uses compass
module Styleguide
class Engine < Rails::Engine
initializer 'styleguide.compass_config' do |app|
config = Compass::Configuration::Data.new("styleguide")
config.images_path = Engine.root.join('app', 'assets', 'images').to_s
config.sprite_load_path << Engine.root.join('app', 'assets', 'images', 'icons').to_s
config.sprite_load_path << Engine.root.join('app', 'assets', 'images', 'widgets').to_s
Compass.add_configuration(config)
end
end
@craigmcnamara
craigmcnamara / deploy_files.rb
Created October 23, 2013 22:05
Capistrano 3 Rails 4 deploy example with public key auth
# Gemfile
#
group :development do
gem 'capistrano', '~> 3.0.0'
gem 'capistrano-rails', '~> 0.0.7'
gem 'capistrano-bundler', '~> 0.0.1'
end
# Capfile
#
@craigmcnamara
craigmcnamara / gist:6677167
Created September 23, 2013 21:23
Gem inabox instructions
## Client Usage
gem install geminabox
gem inabox -c # gem server is http://alzheimers:iforgot@gems.caring.com/
gem inabox my-awesome-gem-1.0.gem
@craigmcnamara
craigmcnamara / gist:5159445
Last active December 14, 2015 22:38 — forked from defunkt/gist:206253
Unicorn
# unicorn -c /data/github/current/config/unicorn.rb -E production -D
rack_env = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rack_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@craigmcnamara
craigmcnamara / gist:5106012
Created March 7, 2013 06:44
Who wrote it?
//I had to override the clone() method
public Object clone() throws CloneNotSupportedException
{
return super.clone();
}
@craigmcnamara
craigmcnamara / First RBX WTF
Created February 22, 2013 00:08
How is one supposed to act on an error like this?
rake test --trace
rake aborted!
wrong constant name line
kernel/common/module.rb:692:in `normalize_const_name'
kernel/common/module.rb:530:in `const_set'
kernel/common/struct.rb:82:in `new'
/Users/craig/.rbenv/versions/rbx-1.2.4/1.8/gems/railties-3.0.20/lib/rails/source_annotation_extractor.rb:16:in `__class_init__ (SourceAnnotationExtractor)'
/Users/craig/.rbenv/versions/rbx-1.2.4/1.8/gems/railties-3.0.20/lib/rails/source_annotation_extractor.rb:15:in `__script__'
kernel/common/codeloader.rb:147:in `require'
kernel/common/kernel.rb:783:in `polyglot_original_require (require)'