Skip to content

Instantly share code, notes, and snippets.

View coffeejunk's full-sized avatar
:shipit:

Maximilian Haack coffeejunk

:shipit:
View GitHub Profile
@weppos
weppos / capistrano_database_yml.rb
Created July 27, 2008 10:04
Provides a couple of tasks for creating the database.yml configuration file dynamically when deploy:setup is run.
#
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <[email protected]>
# Copyright:: 2007-2010 The Authors
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix.
;;
;; * :use makes functions available without a namespace prefix
;; (i.e., refers functions to the current namespace).
;;
;; * :import refers Java classes to the current namespace.
;;
@mbbx6spp
mbbx6spp / page.coffee
Last active October 20, 2024 14:30
jQuery API usage example in CoffeeScript translated to Javascript.
# Creative Commons Attribution-Share Alike 3.0 United States License
# http://creativecommons.org/licenses/by-sa/3.0/us/
# By Susan Potter <https://www.susanpotter.net/software/>
(($) ->
editSubmitHandler: (evt) ->
form: $(this)
data: form.serialize()
url: form.attr('action')
$.getJSON(url, data, (data, resp) ->
$('#notice').html(data['html'])
@aaronvb
aaronvb / dj_recurring.rb
Created October 28, 2010 03:30
This will insert a job into the delayed_job queue outside of Ruby on Rails environment. Useful for recurring jobs using cron.
#!/usr/bin/env ruby
# put this somewhere in your project, ie: /lib
# use:
# crontab -e
# */30 * * * * /usr/bin/ruby /your_rails_project/lib/this_file.rb
# that will insert this job into your delayed_job queue every 30 minutes.
require 'rubygems'
require 'mysql'
@ryanb
ryanb / github_tree_slider.js
Created December 6, 2010 17:23
This is how GitHub's new AJAX file browser works.
GitHub.TreeSlider = function () {
if (window.history && window.history.pushState) {
function a() {
if (e.sliding) {
e.sliding = false;
$(".frame-right").hide();
$(".frame-loading:visible").removeClass("frame-loading")
}
}
if (!($("#slider").length == 0 || !GitHub.shouldSlide)) if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
@robhurring
robhurring / Rakefile
Created December 7, 2010 20:09
Delayed Job with Sinatra -- without sinatra specific gems, etc.
task :environment do
require './dj-sinatra'
end
namespace :jobs do
desc "Clear the delayed_job queue."
task :clear => :environment do
Delayed::Job.delete_all
end
@fnichol
fnichol / README.md
Created January 3, 2011 16:20
Sample chef-solo config for vagrant prototyping
@dpritchett
dpritchett / 1) job-site-renderer.coffee
Created April 19, 2011 18:56
coffeescript jobsite renderer
$(document).ready ->
jobloader.initialize()
window.jobloader =
pulljobs: (callback) ->
$.getJSON '/jobs.json',
(data) ->
callback data
printjobs: (data) ->
@mrrooijen
mrrooijen / deploy.rb
Created May 16, 2011 18:12
Unicorn + Bluepill + Capistrano with RVM
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :application, "my_app"
set :repository, "[email protected]:myuser/myapp.git"
set :branch, "production"
set :rvm_ruby_string, "1.9.2"
set :deploy_to, "/var/applications/"
set :user, "username"
@mwawrusch
mwawrusch / coffeescript_twitter_jquery.coffee
Created May 18, 2011 22:18
Coffeescript implementation of a twitter jquery plugin
# Quick jquery plugin to display recent tweets
# (C) 2011 Martin Wawrusch (@martin_sunset , http://martinatsunset.com, https://github.com/mwawrusch)
#
# The juicy parts are from:
#
# http://www.simonwhatley.co.uk/ (Simon Whatley)
# https://github.com/jimeh (Jim Myhrberg)
#
# I just assembled them in coffeescript.
#