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
#!/bin/bash | |
APP_NAME="your-app-name-goes-here" | |
APP_PATH=/home/deploy/${APP_NAME} | |
# Production environment | |
export RAILS_ENV="production" | |
# This loads RVM into a shell session. Uncomment if you're using RVM system wide. | |
# [[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm" |
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
# Total number of users from last month | |
User.where(last_sign_in_at: 1.month.ago..Date.today).count | |
User.where(last_sign_in_at: 1.month.ago..Date.today).order(:last_sign_in_at).pluck(:email, :last_sign_in_at) | |
# Number of users who updated at least one experiment in the last month | |
Experiment.joins(:user).where(updated_at: 1.month.ago..Date.today).order(:updated_at).pluck(:updated_at, :id, :title, 'users.email').uniq {|r| r.last}.count | |
Experiment.joins(:user).where(updated_at: 1.month.ago..Date.today).order(:updated_at).pluck(:updated_at, :id, :title, 'users.email').uniq {|r| r.last} | |
Experiment.joins(:user).where(updated_at: 1.month.ago..Date.today).order(:updated_at).pluck(:updated_at, :id, :title, 'users.email').uniq {|r| r.last}.map {|a| {a.first.strftime("%b-%Y") => { experiment_title: a[2], user_email: a.last } }} | |
# Number of experiments,grouped by users, created per month for the past 18 months |
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 'builder' | |
require 'digest/md5' | |
class Content < ActiveRecord::Base | |
belongs_to :user | |
end | |
class Section < ActiveRecord::Base | |
has_many :assigned_sections | |
has_many :articles, :order => 'position', :through => :assigned_sections |
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 ./libs/jquery-1.9.1 | |
#= require modernizr-2.0 | |
#= require ender | |
#= require jquery.waitforimages | |
#= require fancybox/jquery.mousewheel-3.0.6.pack | |
#= require fancybox/jquery.fancybox.pack | |
#= require underscore | |
#= require twitter | |
#= require gallery | |
#= require ./libs/lunr.min |
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
BASE_DIR = 'source/_assets/images/galleries' | |
module ImageList | |
def image_list( name ) | |
list = Array.new | |
dir = Dir.new( File.join(BASE_DIR, name) ) | |
dir.each do | d | | |
image = File.basename(d, File.extname(d)) | |
unless d =~ /^\./ || d =~ /thumbs/ | |
list << ["/images/galleries/#{name}/#{d}", "#{name}", "#{image}", "/images/galleries/#{name}/thumbs/#{d}"] |
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
#config/initializers/carrierwave.rb | |
CarrierWave.configure do |config| | |
if Rails.env.production? or Rails.env.development? | |
config.storage :cloud_files | |
config.cloud_files_username = "your_username" | |
config.cloud_files_api_key = "your_key" | |
config.cloud_files_container = "test" | |
config.cloud_files_cdn_host = "c0012345.cdnn.cloudfiles.rackspacecloud.com" | |
def store_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 'minitest/autorun' | |
require_relative 'anagram' | |
class AnagramTest < MiniTest::Unit::TestCase | |
def test_no_matches | |
detector = Anagram.new('diaper') | |
assert_equal [], detector.match(%w(hello world zombies pants)) | |
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
defmodule Twitter do | |
def get_oauth_token | |
consumer_key= "yourkey" | |
consumer_secret = "yoursecret" | |
url = 'https://api.twitter.com/oauth' | |
consumer = Oauthex.Consumer.new( | |
key: :erlang.binary_to_list(consumer_key), | |
secret: :erlang.binary_to_list(consumer_secret) |
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
let g:ScreenImpl = 'Tmux' | |
let g:ScreenShellTmuxInitArgs = '-2' | |
let g:ScreenShellInitialFocus = 'shell' | |
let g:ScreenShellQuitOnVimExit = 0 |
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
" Screen settings | |
map <F5> :ScreenShellVertical<CR> | |
command! -nargs=? -complete=shellcmd W :w | :call ScreenShellSend("load '".@%."';") | |
map <Leader>c :ScreenShellVertical bundle exec rails c<CR> | |
map <Leader>r :w<CR> :call ScreenShellSend("rspec ".@% . ':' . line('.'))<CR> | |
map <Leader>e :w<CR> :call ScreenShellSend("cucumber --format=pretty ".@% . ':' . line('.'))<CR> | |
map <Leader>b :w<CR> :call ScreenShellSend("break ".@% . ':' . line('.'))<CR> |
NewerOlder