Skip to content

Instantly share code, notes, and snippets.

@shekibobo
shekibobo / serialized_encoding.rake
Last active August 29, 2015 13:56
Convert serialized yaml from syck to psych
require 'yaml'
# original idea comes from http://darwinweb.net/articles/convert-syck-to-psych-yaml-format
namespace :encoding do
desc 'convert serialized Content data from syck yaml serializations to psych'
task :psych => :environment do
content_id = ENV['content_id']
if content_id
convert_data Content.find(content_id)
@shekibobo
shekibobo / polymorphic_any_of_spec.rb
Last active August 29, 2015 13:57
polymorphic_any_of_spec.rb
unless File.exists?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'sqlite3'
gem 'activerecord_any_of'
gem 'pry'
gem 'pg'
GEMFILE
@shekibobo
shekibobo / double_polymorphic_any_of_test.rb
Last active August 29, 2015 13:57
double_polymorphic_any_of_test.rb
unless File.exists?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'sqlite3'
gem 'activerecord_any_of'
gem 'pry'
gem 'pg'
GEMFILE
@shekibobo
shekibobo / eager_load_to_sql_bug_test.rb
Created April 10, 2014 20:16
Testing failures of arel related to `eager_load` queries not generating correct `to_sql`.
unless File.exists?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'sqlite3'
gem 'pry'
gem 'pg'
GEMFILE
system 'bundle'
@shekibobo
shekibobo / formatDate.js
Last active August 29, 2015 14:00
Date formatting code used by XDSoft DateTimePicker
//http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/
/*
* Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, version 2.1.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+requirements_osx_brew_libs_install:2> brew unlink libksba
Error: No such keg: /usr/local/Cellar/libksba
+requirements_osx_brew_libs_install:2> true
+requirements_osx_brew_libs_install:3> brew install libksba
==> Downloading ftp://ftp.gnupg.org/gcrypt/libksba/libksba-1.3.0.tar.bz2
Already downloaded: /Library/Caches/Homebrew/libksba-1.3.0.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/libksba/1.3.0
==> make install
libtool: link: cannot determine absolute directory name of `@@HOMEBREW_CELLAR@@/libgpg-error/1.12/lib'
make[2]: *** [libksba.la] Error 1
public class MyApp extends Application {
private static Context context;
private static ObjectGraph objectGraph;
@Override
public void onCreate() {
super.onCreate();
context = this;
@shekibobo
shekibobo / barcampgr-coc.md
Last active August 29, 2015 14:04
BarCamp Grand Rapids - Code of Conduct

BarCamp Grand Rapids Code of Conduct

‬Purpose

A‭ ‬primary‭ ‬goal‭ ‬of‭ BarCamp Grand Rapids‭ ‬is‭ ‬to‭ ‬be‭ ‬inclusive‭ ‬to‭ ‬the‭ ‬largest‭ ‬number‭ ‬of‭ ‬contributors,‭ ‬with‭ ‬the‭ ‬most‭ ‬varied‭ ‬and‭ ‬diverse‭ ‬backgrounds‭ ‬possible.‭ ‬As‭ ‬such,‭ ‬we‭ ‬are‭ ‬committed‭ ‬to‭ ‬providing‭ ‬a‭ ‬friendly,‭ ‬safe‭ ‬and‭ ‬welcoming‭ ‬environment‭ ‬for‭ ‬all,‭ ‬regardless‭ ‬of‭ ‬gender,‭ ‬sexual‭ ‬orientation,‭ ‬ability,‭ ‬ethnicity,‭ ‬socioeconomic‭ ‬status,‭ ‬and‭ ‬religion‭ (‬or‭ ‬lack‭ ‬thereof‭)‬.‭

This‭ ‬code‭ ‬of‭ ‬conduct‭ ‬outlines‭ ‬our‭ ‬expectations‭ ‬for‭ ‬all‭ ‬those‭ ‬who‭ ‬participate‭ ‬in‭ ‬our‭ ‬community,‭ ‬as‭ ‬well‭ ‬as‭ ‬the‭ ‬consequences‭ ‬for‭ ‬unacceptable‭ ‬behavior.

We‭ ‬invite‭ ‬all‭ ‬those‭ ‬who‭ ‬participate‭ ‬in‭ ‬BarCamp Grand Rapids ‬to‭ ‬help‭ ‬us‭ ‬create‭ ‬safe‭ ‬and‭ ‬positive‭ ‬experiences‭ ‬for‭ ‬everyone.

@shekibobo
shekibobo / capybara.rb
Created August 26, 2014 16:14
Conditionally swapping to Selenium for tests with touchy javascript issues.
# spec/support/capybara.rb
require 'capybara/poltergeist'
Capybara.asset_host = 'http://localhost:3000'
Capybara.javascript_driver = :poltergeist
RSpec.configure do |config|
config.before(:each, touchy_js: true) do
Capybara.current_driver = :selenium
@shekibobo
shekibobo / .ackrc
Created August 28, 2014 16:14
dev configs
--type-set=xib=.xib
--type-set=mustache=.mustache
--type-set=rb=.rb
--type-set=erb=.erb
--type-set=haml=.haml
--type-set=sass=.scss,.sass
--type-set=coffee=.coffee
--ignore-dir=log