Skip to content

Instantly share code, notes, and snippets.


ara.t.howard ahoward

View GitHub Profile
ahoward / a.rb
Created Jan 31, 2019
rails just *cannot* run in threads. doing even simple things will bork it in strange and magical ways
View a.rb
class A
attr_accessor :dsl
attr_accessor :state
def initialize
@state = []
@dsl = self.class.dsl
ahoward / example.rb
Created Aug 16, 2018
even though i author'd main.rb - which is a really complete cli tool, i 've been yearning for something simpler for writing small cli tools. eg. in a rails ./scripts/ directory...
View example.rb
#! /usr/bin/env ruby
require_relative '../lib/script.rb'
script {
help '
run {
View a.js
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import firebase from 'firebase'
Vue.config.productionTip = false
View a.rb
require 'open-uri'
require 'json'
module TargetSmartStateDictionary
def TargetSmartStateDictionary.url
@url ||= (
View a.rb
module Util
def mongo_cluster_command_line_options
Mongoid.default_client # Force the setting to be parsed
settings = Map.for(Mongoid.clients[:default])
address = settings[:uri]
unless address && address =~ %r`://`
raise("no uri in #{ settings.inspect }")
View rails_root.rb
# sometimes you need to calculate the rails_root from a subdirectory of a rails' app, eg, lib/capistrano/tasks/db.rake
# this code does it properly, but is verbose. golf it!
rails_root = File.expand_path(Dir.pwd)
until rails_root == '/'
if %w[ Gemfile app public ].all?{|entry| test(?e, "#{ rails_root }/#{ entry }")}
rails_root = File.dirname(rails_root)
View @jamesosel.txt
RT @HorsleyScott: Sad news, close to home: NPR newsman Carl Kasell dies at age 84. He was a consumate broadcaster and a gentle man.
RT @davidmackau: my kink is hannity's own guest chiding him for not disclosing his cohen link
RT @ddale8: Perpetrator of Quebec City mosque massacre was a Trump devotee, took a selfie wearing a MAGA hat, closely followed…
View a.rb
require 'minitest/unit'
require 'minitest/spec'
require 'minitest/autorun'
View a.rb
# you should rely ONLY in the class level interface in your views, aka
# Asset.thumbnail(path, :dimensions => '42x42').url
# and no lib internals for now - this is under development
# this lib handles a few things in a simple interface. highlights:
View -
1) save this file in the rails_root as 'a.rb'
2) run
~> ./bin/rails runner a.rb
3) it should print out something like
You can’t perform that action at this time.