Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
module ActionDispatch
module Routing
class Mapper
def include_routes(file)
file = File.new("#{Rails.root}/config/routes/#{file}.rb", "r")
buffer = ""
while (line = file.gets)
buffer += line
end
file.close
@j-mcnally
j-mcnally / PrettyTableViewCell+StaticCells.h
Created March 4, 2013 00:12
Support for static cells
//
// PrettyTableViewCell+StaticCells.h
//
//
// Created by Justin McNally on 3/3/13.
// Copyright (c) 2013 Kohactive. All rights reserved.
//
@j-mcnally
j-mcnally / deploy.rb
Last active December 15, 2015 12:19
Capistrano deployment for Drupal
#load 'deploy' if respond_to?(:namespace) # cap2 differentiator
##################################
# Edit these
set :application, "APPLICATION_OR_SITE_NAME"
set :host, "SERVER_ADDRESS"
set :repository, "YOUR_GIT_REPO"
set :branch, "master"
set :deploy_to, "PATH_ON_SERVER_TO_DEPLOY_TO"
@j-mcnally
j-mcnally / gist:5259239
Created March 27, 2013 23:50
Handle your create and update code in one method
alias :create, :do_save
alias :update, :do_save
def do_save
@model = Model.find_or_initialize_by_id(params[:id])
if @model.persisted?
@j-mcnally
j-mcnally / codeigniter
Created April 16, 2013 19:46
Wordpress & Codeigniter NGINX
index index.php index.html index.htm;
# enforce www (exclude certain subdomains)
#if ($host !~* ^(www|subdomain))
#{
# rewrite ^/(.*)$ $scheme://www.$host/$1 permanent;
#}
# enforce NO www
#if ($host ~* ^www\.(.*))
@j-mcnally
j-mcnally / sfdc.rake
Last active December 16, 2015 15:19
Salesforce Automation Using Rake
#salesforce automation via rake using the DataBaseDotCom gem
namespace :salesforce do
desc "add salesforce ids to products"
task :match_products => :environment do
client = Databasedotcom::Client.new :host => SFDC_DOMAIN, :client_id => SFDC_APP_ID, :client_secret => SFDC_APP_SECRET
client.authenticate :username => SFDC_EMAIL, :password => SFDC_PASSWORD_AND_TOKEN
#materialize Sobject
client.sobject_module = SFDC::Objects
cl = client.materialize("Product2")
module Middleman
module Emblem
class << self
def registered(app, options={})
require "barber-emblem"
require "middleman-emblem/sprockets-template"
@j-mcnally
j-mcnally / pre-commit.sh
Last active December 18, 2015 01:09
Git pre-commit hook for rspec
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit". The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
contentArrayContains: function(id, type) {
var contains = null;
Ember.get(type, 'collection').forEach(function(item) {
if (item.get('id') === id) {
contains = item;
}
});
return contains;