Skip to content

Instantly share code, notes, and snippets.

View lazyatom's full-sized avatar
🤠
Yes

James Adam lazyatom

🤠
Yes
View GitHub Profile
@lazyatom
lazyatom / playing-with-docker-instructions.md
Last active August 29, 2015 13:56
Austin on Rails - play around with Docker

If you'd like a taste of Docker, here's how to get my silly Taco app running under Docker on your machine.

First, install docker-osx

... using instructions from https://github.com/noplay/docker-osx

curl https://raw.github.com/noplay/docker-osx/0.8.0/docker-osx > /usr/local/bin/docker-osx
chmod +x /usr/local/bin/docker-osx

Then start the docker VM

Keybase proof

I hereby claim:

  • I am lazyatom on github.
  • I am lazyatom (https://keybase.io/lazyatom) on keybase.
  • I have a public key whose fingerprint is BE7C E844 BBAA 3308 53A6 63B5 13FD BF1B D9DA 2B35

To claim this, I am signing this object:

this is a test

  • item one
  • item two
  • item three

test complete! but what about normal lists?

  • thing
  • another thing
@lazyatom
lazyatom / app1.rb
Created February 6, 2015 15:05
Detecting where your library has been required from
# Some userland app code
$LOAD_PATH.unshift "."
require 'lib'
namespace :db do
namespace :migrate do
task :check_for_pending_plugin_migrations do
new_migrations = {}
Dir["vendor/plugins/**/migrations/*.rb"].each do |migration_file|
path_parts = migration_file.split("/")
plugin_name = path_parts[path_parts.index("migrations")-1]
migration_name = path_parts.last
unless File.exist?(File.join("db", "migrate", migration_name))
<form ...>
<input type="checkbox" name="user[email_enabled]">
<input type="radio" name="user[email_settings]" value="pm_daily">
<input type="radio" name="user[email_settings]" value="pm_instant">
...
</form>
class Controller
def update
require 'net/http'
require 'rubygems'
require 'json'
EMAIL = "your@email.com"
PASSWORD = "yourpassword"
def get_stikkits(page = 1)
response = Net::HTTP.start('api.stikkit.com') { |http|
req = Net::HTTP::Get.new("/stikkits.json?page=#{page}")
#!/usr/bin/env ruby
require 'fileutils'
require 'singleton'
class Gitster
include Singleton
def initialize
@created_flags = []
<h2>My recent links about boobs</h2>
<ul>
{% recent limit 10, tag 'boobs' do |link| %}
<li><a href="{{ link.href }}">{{ link.text }}</a></li>
{% endrecent %}
</ul>
ActionController::Routing::Routes.capture(:my_plugin_or_whatever) do |map|
map.resource :plugin_stuff
map.connect "/plugin/:blah", :controller => "whatever"
end