Skip to content

Instantly share code, notes, and snippets.

View pengwynn's full-sized avatar

Wynn Netherland pengwynn

View GitHub Profile
@pengwynn
pengwynn / backslash.rb
Created January 9, 2015 01:06
Where I prefer \ to parens in Ruby
hash.update \
:name => profile.name,
:company => profile.company,
:blog => profile.blog,
:location => profile.location,
:email => profile.email,
:hireable => profile.hireable,
...
@pengwynn
pengwynn / strings.rb
Created January 9, 2015 02:26
Ghetto heredoc
message = "Hello there, wayfaring stranger. If you're reading this then " \
"you probably didn't see our blog post a couple of years " \
"back announcing that this API would go away: http://git.io/17AROg " \
"Fear not, you should be able to get what you need from the shiny new " \
"Events API instead."
// change thematic's default nav to be category based instead of page based
// Create #access
// In the header div
function mytheme_access() { ?>
<div id="access">
<div class="skip-link"><a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>"><?php _e('Skip to content', 'thematic'); ?></a></div>
<!-- list categories instead, see args here: http://codex.wordpress.org/Template_Tags/wp_list_categories -->
<?php wp_list_categories('orderby=name&show_count=1&exclude=10'); ?>
</div><!-- #access -->
# Are you ready to Tumblllllllllllllllllllllllllllllllle?
sudo gem install gemcutter
gem tumble
# include this in application controller
module Authentication
protected
# Inclusion hook to make #current_user and #signed_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method
end
# Returns true or false if the user is signed in.
require 'rubygems'
require 'twitter'
h = Twitter::HTTPAuth.new 'username', 'password'
twitter = Twitter::Base.new(h)
source_user = 'username'
source_slug = 'list-name'
target_user = 'username'
target_slug = 'list-name'
# Set up .gitignore
file '.gitignore', <<-GITIGNORE
config/database.yml
log/*.log
tmp/**/*
.DS\_Store
.DS_Store
db/test.sqlite3
db/development.sqlite3
/log/*.pid
# Set up Compass/Sass
require 'sass/plugin/rack'
require 'compass'
use Sass::Plugin::Rack
Compass.configuration do |config|
config.project_path = File.dirname(__FILE__)
config.sass_dir = "sass"
config.css_dir = "public/css"
end
Compass.configure_sass_plugin!
<script src="http://www.buzzsprout.com/105/2916-episode-0-1-5-leah-culver-on-oauth-hurl-it-baconfile-and-more.js?player=small" type="text/javascript" charset="utf-8"></script>