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 "vcr" | |
require "net/http" | |
VCR.configure do |c| | |
c.cassette_library_dir = '/tmp' | |
c.hook_into :webmock | |
c.default_cassette_options = { | |
record: :once | |
} |
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 | |
set -e | |
# Example init script, this can be used with nginx, too, | |
# since nginx and unicorn accept the same signals | |
# Feel free to change any of the following variables for your app: | |
TIMEOUT=${TIMEOUT-60} | |
APP_ROOT=/path/to/your/app/current | |
PID=$APP_ROOT/tmp/pids/unicorn.pid | |
ENVIRONMENT=production |
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
# First, make sure that you have the most recent rvm. Several bugs with 2.0.0-preview1 | |
# have recently been fixed. | |
# | |
# Second, the openssl that comes with MacOS is too old for Ruby 2.0. You need to install | |
# a newer one with homebrew or the rvm pkg command. | |
# Option 1, with homebrew openssl: | |
brew update | |
brew install openssl |
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
# Gemfile | |
gem 'redis', '~> 3.0.1' |
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 | |
#!/usr/bin/env ruby | |
######################################### | |
# Define source and destinations | |
MONGO_DBS="" | |
BACKUP_TMP=~/tmp | |
BACKUP_DEST=~/backups | |
MONGODUMP_BIN=/Users/wahyusumartha/Documents/mongodb-db/bin/mongodump | |
TAR_BIN=/usr/bin/tar |
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 | |
# | |
# MongoDB Backup Script | |
# VER. 0.1 | |
# Note, this is a lobotomized port of AutoMySQLBackup | |
# (http://sourceforge.net/projects/automysqlbackup/) for use with | |
# MongoDB. | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by |
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
# blog post: | |
# Before using this initializer, you must set up Cancan. First, add the gem to your Gemfile: | |
# | |
# gem 'cancan' | |
# | |
# Next, generate and edit an Ability class: | |
# | |
# rails generate cancan:ability | |
# |
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
# coding: utf-8 | |
# This is a Rails init template with MongoDB projects | |
# | |
# Mongoid, Devise, Bootstrap, jQuery, Redis, Cells, will_paginate, Carrierwave, simple_form, Settingslogic, Thin | |
# | |
# Usage | |
# | |
# $ rails new app_name -m https://raw.github.com/gist/2168014 | |
# |
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
exports.ext = function () { | |
var extTypes = { | |
"3gp" : "video/3gpp" | |
, "a" : "application/octet-stream" | |
, "ai" : "application/postscript" | |
, "aif" : "audio/x-aiff" | |
, "aiff" : "audio/x-aiff" | |
, "asc" : "application/pgp-signature" | |
, "asf" : "video/x-ms-asf" | |
, "asm" : "text/x-asm" |
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
#save it as config/initializers/html_in_json.rb | |
ActiveSupport.escape_html_entities_in_json = true | |
#next line is not really compulsory. It just sanitizes output(not just replaces with \u values of html entities) to protect you from DOM XSSes. | |
ActiveSupport::JSON::Encoding::ESCAPED_CHARS.merge! '<' => '<' |
NewerOlder