Skip to content

Instantly share code, notes, and snippets.

View leoromanovsky's full-sized avatar

Leo Romanovsky leoromanovsky

View GitHub Profile
@Kalisen
Kalisen / up_plugin
Created December 29, 2011 01:22
list/upgrade plugin's version across all projects
#/bin/sh
PLUGIN_NAME=$1
PLUGIN_VERSION=$2
if [ -z "$1" -o "$1" = "-h" ]
then
echo Usage:
echo List usage of a plugin:
@iainbeeston
iainbeeston / application_helper.rb
Created March 6, 2012 23:43
Facebook real-time updates Rails Metal controller.
module ApplicationHelper
def signature(str, key = nil)
key ||= CONFIG['facebook']['secret'] if defined?(CONFIG)
OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new('sha1'), key, str)
end
end
@danneu
danneu / anemone.rb
Created April 24, 2012 02:58
Crawls http://isbullsh.it and stores each blog post title & tag into MongoDB. RE: http://news.ycombinator.com/item?id=3878605
require 'anemone'
require 'mongo'
# Patterns
POST_WITHOUT_SLASH = %r[\d{4}\/\d{2}\/[^\/]+$] # http://isbullsh.it/2012/66/here-is-a-title (301 redirects to slash)
POST_WITH_SLASH = %r[\d{4}\/\d{2}\/[\w-]+\/$] # http://isbullsh.it/2012/66/here-is-a-title/
ANY_POST = Regexp.union POST_WITHOUT_SLASH, POST_WITH_SLASH
ANY_PAGE = %r[page\/\d+] # http://isbullsh.it/page/4
ANY_PATTERN = Regexp.union ANY_PAGE, ANY_POST
@semipermeable
semipermeable / tddium_post_build.rake
Last active October 4, 2015 12:48
Tddium post-build task to deploy into Heroku
def cmd(c)
system c
end
namespace :tddium do
desc "post_build_hook"
task :post_build_hook do
# This build hook should only run after CI builds.
#
# There are other cases where we'd want to run something after every build,
@rwdaigle
rwdaigle / newrelic.yml
Last active November 24, 2015 07:54 — forked from wuputah/newrelic.yml
New Relic config file for apps on Heroku Cedar
#
# This file configures the New Relic Agent. New Relic monitors
# Ruby, Java, .NET, PHP, and Python applications with deep visibility and low overhead.
# For more information, visit www.newrelic.com.
#
# Generated June 03, 2013
#
# This configuration file is custom generated for Barsoom
@jphenow
jphenow / deploy.rake
Last active December 18, 2015 00:09 — forked from njvitto/deploy.rake
#Deploy and rollback on Heroku in staging and production
%w[staging production].each do |app|
desc "Deploy to #{app}"
task "deploy:#{app}" => %W[deploy:set_#{app}_app deploy:push deploy:restart deploy:tag]
desc "Deploy #{app} with migrations"
task "deploy:#{app}:migrations" => %W[deploy:set_#{app}_app deploy:push deploy:off deploy:migrate deploy:restart deploy:on deploy:tag]
desc "Rollback staging"
@thom4parisot
thom4parisot / Gruntfile.js
Last active December 20, 2015 11:49
Chrome Extension Channel Example
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
manifest: grunt.file.readJSON('src/manifest.json'),
zip: {
extension: {
cwd: 'src/',
src: [
@chriskjaer
chriskjaer / gulpfile.js
Last active November 1, 2017 08:22
Gulp recipe: Jade, Sass, Livereload and static server
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-sass'),
csso = require('gulp-csso'),
uglify = require('gulp-uglify'),
jade = require('gulp-jade'),
concat = require('gulp-concat'),
livereload = require('gulp-livereload'), // Livereload plugin needed: https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei
tinylr = require('tiny-lr'),
express = require('express'),
@keit
keit / gist:6288233
Last active February 22, 2018 15:01
Rails4 + Bower + Bootstrap set-up
This document is outdated.
You should read David Bryant Copeland's excellent online book: http://angular-rails.com/crud_recipe.html
---------------------------------------------------------------------------------------------------------------
I think it's better to install javascript/css libraries using Bower rather than gem which is Ruby packager.
1. Install Rails 4 and create a new project.
2. Install bower(Note you need to install node first.)
sudo npm install -g bower
@filtersquad
filtersquad / gcwi.rb
Created June 21, 2011 05:40
A preliminary clicky client example built on api_smith
require 'rubygems'
require 'api_smith'
require 'date'
require 'ipaddr'
module GettinClickyWithIt
class Error < StandardError; end
SMART_NUMBER_TRANSFORMER = lambda { |v| Integer(v) rescue v }