Skip to content

Instantly share code, notes, and snippets.

View clarkware's full-sized avatar

Mike Clark clarkware

View GitHub Profile
https://hachyderm.io/@mikeclark
@clarkware
clarkware / rails_edge
Created November 2, 2021 21:47
Bash script to generate an edge-Rails app.
#!/bin/sh
#
# Generates an edge-Rails application.
if [ $# -eq 0 ]
then
echo "usage: rails_edge <name>"
exit 1
fi
@clarkware
clarkware / gist:fa82e794e7936e04ec69
Last active August 29, 2015 14:11
Generating basic HTML, Elm style
import List (..)
import Graphics.Element (..)
import Text (..)
import Html (..)
import Html.Attributes (..)
import Html.Events (..)
todos1 = ["A", "B", "C"]
todos2 = ["D", "E", "F"]
import Text (..)
import String (..)
import Color (..)
import Graphics.Element (..)
import Graphics.Collage (..)
greet name age =
plainText ("Hello, " ++ name ++ "! You don't look " ++ toString(age) ++ "!")
add x y = x + y
class ChangePerspective < ActiveRecord::Migration
def change
rename_table :users, :customers
end
end
@clarkware
clarkware / lyrics.rb
Created September 10, 2012 20:05
Random Lyrics
#!/usr/bin/env ruby
# API Documentation at http://api.wikia.com/wiki/LyricWiki_API
require 'open-uri'
require 'json'
require 'tmpdir'
ARTIST = "Johnny Cash"
class Course < ActiveRecord::Base
def self.prototype(overrides={})
attributes = {
:code => 'ruby',
:title => 'Ruby Programming',
:active => true,
:released_on => 15.days.ago
}
new(attributes.merge(overrides))
end
@clarkware
clarkware / gist:1333721
Created November 2, 2011 14:08
TextMate and Ruby 1.9.3
#
# Run this inside TextMate using Cmd-R
#
# puts x
#
# Basically any error will trigger it.
/Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/catch_exception.rb:15:[BUG] Segmentation fault
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
@clarkware
clarkware / gist:1046693
Created June 25, 2011 17:37
View Source for Ruby
# Toss this in your ~/.irbrc file for a convenient way
# to peruse Ruby source code in TextMate. This
# only works in Ruby 1.9!
#
# Use it in irb like so:
#
# >> require 'active_record'
# >> ActiveRecord::Base.source_for_method(:create)
class Object