Skip to content

Instantly share code, notes, and snippets.

View jwreagor's full-sized avatar

J R jwreagor

  • New Gillington, WI
View GitHub Profile

Proposed View-layer changes

Friday, Juan, Tom, Yehuda and I had a meeting where we discussed the renderer APIs and some ideas we had for the view layer. Here is what we came up with:

Overview

The purpose of these proposed changes is to lower the learning curve for users entering the SproutCore world and who are looking for quick feedback and an easy way to create custom views

@jwreagor
jwreagor / config_set_var_re-eval_example.rb
Created February 1, 2011 06:25
Example of variable re-evaluation after setter usage in ConfigSet.
# Set some values...
config = ConfigSet.for('routes') {
host "codeforpeople.com"
port 80
signup_url "http://#{ host }/signup"
signout_url "http://#{ port }/signout"
app {
signup_url "http://#{ host }/signup"
@aliang
aliang / application_controller.rb
Created February 1, 2011 23:53
Force SSL on Devise routes only, then redirect back
class ApplicationController < ActionController::Base
# Tell Devise to redirect after sign_in
def after_sign_in_path_for(resource_or_scope)
some_url(:protocol => 'http')
end
# Tell Devise to redirect after sign_out
def after_sign_out_path_for(resource_or_scope)
some_url(:protocol => 'http')
end
@mstepniowski
mstepniowski / fullscreen-lion.diff
Created July 20, 2011 22:19
Add Lion-based fullscreen mode to Emacs 24
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 447d7fd..27bba4a 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -929,6 +929,11 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
+(defun ns-toggle-fullscreen ()
@shapeshed
shapeshed / unicorn
Created September 16, 2011 10:12
Unicorn / Monit setup
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/path/to/your/app/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENVIRONMENT=production

Fibur

Fibur is a library that allows concurrency during Ruby I/O operations without needing to make use of callback systems. Traditionally in Ruby, to achieve concurrency during blocking I/O operations, programmers would make use of Fibers and callbacks. Fibur eliminates the need for wrapping your I/O calls with Fibers and a callback. It allows you to write your blocking I/O calls the way you normally would, and still have concurrent execution during those I/O calls.

Example

Say you have a method that fetches data from a network resource:

Routing in Ember

In Ember, the application's state manager handles routing. Let's take a look at a simple example:

App.stateManager = Ember.StateManager.create({
  start: Ember.State.extend({
    index: Ember.State.extend({
      route: "/",
@rubysolo
rubysolo / offline-backup.coffee
Created June 20, 2012 15:45
use localStorage to store form datas
class OfflineBackup
constructor: ->
@pendingRequests = JSON.parse(localStorage.getItem('offline-backups') || '[]')
$('form.offline-backup').on 'submit', @submitForm
window.addEventListener 'online', @submitPendingRequests
submitForm: (e) ->
unless navigator.onLine
method = $(this).find('input[name=_method]').val() || $(this).attr('method') || 'get'
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active August 12, 2025 06:37
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dkubb
dkubb / git-remove-merged.sh
Last active March 8, 2023 17:24 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
git remote update &&
git remote prune origin &&
git branch -r --merged origin/master |
awk -F"/" '!/(>|master)/ {print $2}' |
xargs -rL1 git push origin --delete