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
# One liner | |
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com | |
# Explained | |
wget \ | |
--recursive \ # Download the whole site. | |
--page-requisites \ # Get all assets/elements (CSS/JS/images). | |
--adjust-extension \ # Save files with .html on the end. | |
--span-hosts \ # Include necessary assets from offsite as well. | |
--convert-links \ # Update links to still work in the static version. |
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
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
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
/** | |
* Module dependencies. | |
*/ | |
var express = require('express') | |
, routes = require('./routes') | |
, user = require('./routes/user') | |
, http = require('http') | |
, path = require('path') |
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
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
requirejs(['cordova.js'], | |
function () { | |
// start of require | |
// cordova is now available globally | |
var exec = cordova.require('cordova/exec'); | |
var app = { | |
// Application Constructor |
# 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
rewrite ^/sitemap1.xml.gz /sitemaps/$host/sitemap1.xml.gz last; | |
rewrite ^/sitemap_index.xml.gz /sitemaps/$host/sitemap_index.xml.gz last; | |
# or | |
location /sitemap { | |
# it can be already switched on for globally | |
# gzip_static on; | |
rewrite ^/sitemap.xml /sitemaps/$host/sitemap.xml last; # that's will catch .gz files and served as normal static file, but with gzip header |
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) |
NewerOlder