This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
# ZSH_THEME="alanpeabody" | |
# Example aliases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/tasks/load_tasks.rake | |
# ------------ | |
# Looks at every .rb file in the lib/tasks and adds them to rake within the | |
# namespace of their subdirectories | |
# ------------ | |
# Important to note we are looking specifically for .rb files, so they | |
# aren't added to the global rake namespace | |
Dir.glob("#{Rails.root}/lib/tasks/**/*.rb").each do |file| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% # app/views/posts/_post.html.erb %> | |
<article> | |
<h2><%= post.title %></h2> | |
<!-- ... --> | |
</article> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'htmlentities' | |
gem 'nokogiri' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/image.rb | |
class Image < ActiveRecord::Base | |
has_many :taggings, :as => :taggable | |
has_many :tags, :through => :taggings | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Include libraries | |
# | |
require 'fileutils' | |
# Make sure we have our argument | |
# | |
if ARGV.size < 1 | |
puts "Usage: project [DIR]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
desc 'Import local files (with csv references) using Dragonfly' | |
task :dragonfly_import => :environment do | |
config = [ | |
{:model => Attachment, :attr => :document} | |
] | |
storage_dir = "#{Rails.root}/lib/cw_refs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
def download_image(url, dest) | |
open(url) do |u| | |
File.open(dest, 'wb') { |f| f.write(u.read) } | |
end | |
end | |
urls = [ | |
'http://petsfans.com/wp-content/uploads/2014/11/edfsaf.jpg', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assumes: | |
# - curl is installed | |
# - you have a slack channel with an incoming webhook configured | |
require 'json' | |
def notify_slack(webhook_url, channel, username, text, image) | |
payload = { | |
:channel => channel, | |
:username => username, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.bg-video { | |
position: fixed; | |
top: 0; | |
left: 0; | |
width: 100vw; | |
height: 100vh; | |
overflow: hidden; | |
z-index: -1; | |
} |
OlderNewer