Navigation Menu

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.
View GitHub Profile
@ahoward
ahoward / a.rb
Created April 18, 2017 14:05
categorize your taxes in a hurry with this ruby script!
#! /usr/bin/env ruby
require 'csv'
require 'pp'
require 'readline'
require 'fileutils'
require 'rubygems'
require 'main'
// force certain pages to be refreshed every time. mark such pages with
// 'data-cache="never"'
//
jQuery('div').live('pagehide', function(event, ui){
var page = jQuery(event.target);
if(page.attr('data-cache') == 'never'){
page.remove();
};
});
@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 / wtf-google-geocode.json
Created February 3, 2011 19:57
wtf - alaska... or texas!?
{
"status": "OK",
"results": [ {
"types": [ "park", "establishment" ],
"formatted_address": "Kincaid Park, 6998 Raspberry Rd, Anchorage, Texas 99502, USA",
"address_components": [ {
"long_name": "Kincaid Park",
"short_name": "Kincaid Park",
"types": [ "establishment" ]
}, {
@ahoward
ahoward / proc-gt-module.rb
Created November 29, 2011 22:28
proc > module
#! /usr/bin/env ruby
# ClassMethods/InstanceMethods as modules are nice. but procs are mo betta. you can't do any of the following via modules.
#
module M
ClassMethods = proc do
class << self
alias_method 'bar', 'foo'
end
@ahoward
ahoward / favicon.sh
Created August 27, 2012 20:05
a simple favicon generator using image magick
#! /bin/sh
# file : ~/bin/favicon
#
# usage: favicon foo.png
convert "$@" -resize 16x16 favicon-16.png
convert "$@" -resize 32x32 favicon-32.png
convert "$@" -resize 64x64 favicon-64.png
convert "$@" -resize 128x128 favicon-128.png
@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)
#! /usr/bin/env ruby
# this is best practice for writing mixins. the deferred evaluation is more
# powerful that the approach of ClassMethods/InstanceMethods as modules too
#
module Mixin
# put your class level code in here
#
ClassMethods = proc do
@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 {