Skip to content

Instantly share code, notes, and snippets.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
def thumb(size)
begun_at = Time.now
size.gsub!(/#/, '!')
uploader = Class.new(self.class)
uploader.versions.clear
uploader.version_names = [size]
<div class='content'>
<!-- your application code, which requires some JS -->
</div>
<% content_for :javascript do %>
<script type="text/javascript">
$(function () {
$('th').tooltip();
});
</script>
#!/usr/bin/env ruby
# Author : Emad Elsaid (https://github.com/blazeeboy)
require 'linkedin' # gem install linkedin
require 'json'
# create an appliation then
# get your api keys at https://www.linkedin.com/secure/developer
config = {
your_consumer_key: 'xxxxxxxxxxxxxxxx',
your_consumer_secret: 'xxxxxxxxxxxxxxxx',

My modified fork of agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

Compatibility

require 'csv'
class Exporter
DEFAULT_EXPORT_TABLES = [ Invoice, InvoiceItem, Item, Merchant, Transaction, User ]
DESTINATION_FOLDER = "tmp/"
def self.export_tables_to_csv(tables = DEFAULT_EXPORT_TABLES)
tables.each { |klass| export_table_to_csv(klass) }
end
# install rvm
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
# install ruby 1.9.2 + some global gems
rvm install 1.9.2
rvm use 1.9.2@global
gem install awesome_print map_by_method wirble bundler builder pg cheat
gem install -v2.1.2 builder
@rtcoms
rtcoms / .bashrc
Created January 15, 2013 09:08 — forked from mcjim/.bashrc
# Quick fork by @mcjim to add stash status and tweak to suit his style.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# host dir master $ # clean working directory
# host dir master* $ # dirty working directory
# host dir master*^ $ # dirty working directory with stash
# host dir master^ $ # clean working directory with stash
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
@rtcoms
rtcoms / gist:4358371
Created December 22, 2012 10:31 — forked from pahanix/gist:885671
# config/initializers/clear_logs.rb
# This snippet simply clears your logs when they are too large.
# Large logs mean looooong search in TextMate. You know it :)
# Every time you run rails server or rails console it checks log sizes
# and clears the logs for you if necessary.
if Rails.env.development?
MAX_LOG_SIZE = 2.megabytes
require 'yaml'
# Simple loading of environment-namespaced config files with local overrides.
#
# LiteConfig(:foobar)
#
# loads and caches the current environment section from:
#
# config/foobar.yml
#