Skip to content

Instantly share code, notes, and snippets.

View ahoward's full-sized avatar
💭
probably outside if i'm not hacking.

ara.t.howard ahoward

💭
probably outside if i'm not hacking.
  • https://drawohara.io
  • Palmer, Alaska
  • 15:14 (UTC -08:00)
  • Instagram drawohara
View GitHub Profile
@ahoward
ahoward / web-servers.md
Created September 25, 2019 16:27 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ahoward
ahoward / web-servers.md
Created September 25, 2019 16:27 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ahoward
ahoward / a.rb
Created January 31, 2019 16:36
rails just *cannot* run in threads. doing even simple things will bork it in strange and magical ways
class A
attr_accessor :dsl
attr_accessor :state
def initialize
@state = []
@dsl = self.class.dsl
sleep(rand)
@ahoward
ahoward / example.rb
Created August 16, 2018 18:19
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...
#! /usr/bin/env ruby
require_relative '../lib/script.rb'
script {
help '
HELP!
'
run {
// 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
#
require 'open-uri'
require 'json'
#
module TargetSmartStateDictionary
def TargetSmartStateDictionary.url
@url ||= (
'https://gist.githubusercontent.com/mshafrir/2646763/raw/8b0dbb93521f5d6889502305335104218454c2bf/states_hash.json'
)
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 }")
# 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 }")}
break
else
rails_root = File.dirname(rails_root)
@jamesosel
RT @HorsleyScott: Sad news, close to home: NPR newsman Carl Kasell dies at age 84. He was a consumate broadcaster and a gentle man.
--
@jamesosel
RT @davidmackau: my kink is hannity's own guest chiding him for not disclosing his cohen link https://t.co/Jiy4O65PoO
--
@jamesosel
RT @ddale8: Perpetrator of Quebec City mosque massacre was a Trump devotee, took a selfie wearing a MAGA hat, closely followed… https://t.co/vHg5gqmhMx
--
@jamesosel
@ahoward
ahoward / a.rb
Last active April 12, 2018 23:57
##
#
require 'minitest/unit'
require 'minitest/spec'
require 'minitest/autorun'
##
#
MiniTest::Unit::TestCase.i_suck_and_my_tests_are_order_dependent!