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 Coders | |
class Marshal | |
attr_reader :klass | |
def initialize(klass) | |
@klass = klass | |
end | |
def load(data) |
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 Api::BaseController < ActionController::Base | |
protect_from_forgery with: :null_session | |
before_action :unauthorized_if_signed_out | |
layout false | |
def current_user | |
@current_user ||= ( | |
authenticate_or_request_with_http_token do |token, options| | |
User.find_by(api_key: token) | |
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 ResqueStaleWorkerCleaner | |
SLOWEST_JOB = (ENV["SLOWEST_JOB"] || 30).to_i # minutes | |
def call | |
Resque.workers.each do |worker| | |
worker.unregister_worker if old_worker?(worker) | |
end | |
end | |
private |
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
echo 1 > /proc/sys/vm/overcommit_memory |
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
# Author: Michael van Rooijen | |
# Description: | |
# If you are using my Capistrano Recipe, be sure to add these lines to your .gitignore file. | |
# It will prevent problems when deploying incase your generated the all.js/all.css, assets, database.yml etc. | |
# Assets and Database yaml should be stored in the "shared" section of the application, not inside the actual application with every release. | |
.DS_Store | |
log/*.log | |
tmp/**/* | |
config/database.yml |
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: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
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
(function($){ | |
/** | |
* jQuery PluginName | |
* | |
* @plugin {PluginName} | |
* @description {PluginDescription} | |
* | |
* @changelog | |
* @{mm/dd/yyyy} {version} {author} {changedescription} |
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
# Inside the model.rb | |
has_attached_file :image, | |
:url => "/assets/images/:style/:id.:basename.:extension", | |
:path => ":rails_root/public/assets/images/:style/:id.:basename.:extension", | |
:styles => { | |
:small => '50x45#', | |
:medium => '150x150', | |
:large => '300x300' | |
} |
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
# Place this line below in your environment.rb to remove the Form Error Decorations that display when the form validation failed. | |
ActionView::Base.field_error_proc = proc { |input, instance| input } |
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
.CodeRay { | |
background-color: #232323; | |
border: 1px solid black; | |
font-family: 'Courier New', 'Terminal', monospace; | |
color: #E6E0DB; | |
padding: 3px 5px; | |
overflow: auto; | |
font-size: 12px; | |
margin: 12px 0; | |
} |
OlderNewer