# create an SSL folder for your environment.
mkdir -p ~/.ssl/development/
cd ~/.ssl/development/
# create private key / certificate for your app
# /!\ remember to define the expected common name for you development hostname [if your using localhost, use localhost. If you are using a custom domain, use it]
openssl genrsa -out my_app_key.pem 1024
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/sh | |
### BEGIN INIT INFO | |
# Provides: resque-web | |
# Required-Start: $syslog | |
# Required-Stop: $syslog | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: web interface for resque processing |
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 | |
find . \( -iname '*.rb' -o -iname '*.css' -o -iname '*.js' -o -iname '*.erb' -o -iname '*.html' -o -iname '*.haml' -o -iname '*.scss' -o -iname '*.coffee' \) -exec wc -l {} + | sort -n |
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
# For finding images as in Article.attachments.images | |
scope :with_images, proc { |attachment| where('?_content_type LIKE ?', attachment, 'image%') } | |
# For finding other files Article.attachments.docs | |
scope :with_docs, proc { |attachment| where('?_content_type NOT LIKE ?', attachment, 'image%') } |
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 | |
# | |
# PostgreSQL Backup Script Ver 1.0 | |
# http://autopgsqlbackup.frozenpc.net | |
# Copyright (c) 2005 Aaron Axelsen <[email protected]> | |
# | |
# This script is based of the AutoMySQLBackup Script Ver 2.2 | |
# It can be found at http://sourceforge.net/projects/automysqlbackup/ | |
# | |
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9 |
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 'resque/errors' | |
class DatabaseBackupJob | |
def self.perform(id, foo, bar) | |
# do backup work | |
rescue Resque::TermException | |
# write failure to database | |
# re-enqueue the job so the job won't be lost when scaling down. | |
Resque.enqueue(DatabaseBackupJob, id, foo, bar) |
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 'resque_mailer' | |
require 'devise/async' | |
# pop and set locale from the args before running | |
module PerformWithLocale | |
def perform(*args) | |
I18n.with_locale(args.pop) do | |
super(*args) | |
end | |
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
class Classname | |
constructor: (@args...) -> | |
# returns itself | |
console.log regularFunction() | |
instanceMethod: (args) -> | |
"return from instanceMethod" | |
_privateInstanceMethod: () -> | |
"return from private instanceMethod" |
This is an example of how to use the Google Drive file picker and Google Drive API to retrieve files from Google Drive using pure JavaScript. At the time of writing (14th July 2013), Google have good examples for using these two APIs separately, but no documentation on using them together.
Note that this is just sample code, designed to be concise to demonstrate the API. In a production environment, you should include more error handling.
See a demo at http://stuff.dan.cx/js/filepicker/google/
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
[core] | |
editor = vim | |
excludesfile = ~/.gitignore_global | |
# Treat spaces before tabs and all kinds of trailing whitespace as an error. | |
# [default] trailing-space: looks for spaces at the end of a line | |
# [default] space-before-tab: looks for spaces before tabs at the beginning of | |
# a line | |
whitespace = space-before-tab,-indent-with-non-tab,trailing-space | |
# Make `git rebase` safer on OS X | |
# More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/> |
OlderNewer