Skip to content

Instantly share code, notes, and snippets.

View stackdump's full-sized avatar

stackdump stackdump

View GitHub Profile
#!/usr/bin/ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = '/usr/bin/env ctags'
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks'
@bbrowning
bbrowning / TorqueBox on Heroku.md
Last active December 9, 2015 16:19
TorqueBox on Heroku

With Heroku's JRuby support you may have already seen that you can run TorqueBox Lite on Heroku. But, that only gives you the web features of TorqueBox. What about scheduled jobs, backgroundable, messaging, services, and caching?

With a small amount of extra work, you can now run the full TorqueBox (minus STOMP support and clustering) on Heroku as well! I've successfully deployed several test applications, including the example Rails application from our Getting Started Guide which has a scheduled job, a service, and uses backgroundable and messaging.

This example uses TorqueBox 3.0.2, but the instructions may work with other TorqueBox versions.

Steps Required

  1. Create a JRuby application on Heroku, or convert an existing application to JRuby. Make sure your application works on JRuby on Heroku before throwing TorqueBox into the mix.
  2. Add th
@thompson4822
thompson4822 / testElem.coffee
Created June 24, 2013 20:00
Defining AngularJS directives in CoffeeScript
@angular.module('HelloApp', ['components'])
@angular.module('components', [])
.directive('testElem', ->
restrict: 'A'
template: '<div class="my-directive-class"><h1>Hello...</h1><p ng-repeat="obj in arr">{{obj}}</p></div>'
link: (scope, iterStartElement, attr) ->
$(".my-directive-class").css({ 'background-color': 'yellow'})
scope.arr = ["Steve", 'is', 'the', 'beast']
)
@DXist
DXist / gist:6002285
Created July 15, 2013 18:38
Git wrapper updating ctags
function git() {
GIT_CMD=`which git`
$GIT_CMD "$@"
status="$?"
[[ $status = 0 ]] || return $status
for opt in "$@"; do
case "$opt" in
commit | rebase)
$GIT_CMD ctags
@tobias
tobias / run_tags.rb
Created January 1, 2009 16:44
A script for generating TAGS from a git hook.
#!/usr/bin/ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = '/opt/local/bin/ctags'
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks'
@socketwiz
socketwiz / cloud-config.yml
Last active April 6, 2018 06:51
CoreOS cloud-config for DigitalOcean with iptables firewall
#cloud-config
coreos:
etcd2:
# generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
# specify the initial size of your cluster with ?size=X
discovery: https://discovery.etcd.io/<token>
# multi-region and multi-cloud deployments need to use $public_ipv4
advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001
initial-advertise-peer-urls: http://$private_ipv4:2380
@sailor
sailor / Vagrantfile
Created March 25, 2015 13:09
Vagrantfile for Rails development environment
VAGRANTFILE_API_VERSION = '2'
$install = <<SCRIPT
curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig
chmod +x /usr/local/bin/fig
SCRIPT
$build = <<SCRIPT
cd /vagrant
fig build
@leafo
leafo / gist:6788652
Last active May 1, 2019 13:28
Making nonblocking http requests with lua-ev and LuaSocket
bit = require "bit"
ev = require "ev"
ltn12 = require "ltn12"
socket = require "socket"
-- make protect and newtry coroutine friendly
socket.protect = (fn) -> fn
socket.newtry = (finalizer) ->
(...) ->
/** @jsx React.DOM */
var MyComponent = React.createClass({
render: function() {
// Defaults in case the props are undefined. We'll have a solution for this
// soon that is less awkward.
var perMinute = this.props.perMinute || '-';
var perDay = this.props.perDay || '-';
return (
<div>
<h3>Clickouts</h3>
@jiffyclub
jiffyclub / tserv
Last active September 3, 2020 09:14
Start a Tornado static file server in a given directory. To start the server in the current directory: `tserv .`. Then go to `http://localhost:8000` to browse the directory.
#!/usr/bin/env python
"""
Starts a Tornado static file server in a given directory.
To start the server in the current directory:
tserv .
Then go to http://localhost:8000 to browse the directory.
Use the --prefix option to add a prefix to the served URL,