Skip to content

Instantly share code, notes, and snippets.

View jmdfm's full-sized avatar
💭
😺

John McDowall jmdfm

💭
😺
View GitHub Profile
@gregfroese
gregfroese / gist:4124753
Created November 21, 2012 13:04
Posting an image in RubyMotion using BubbleWrap and saving it in Rails
## RubyMotion
imageData = UIImage.UIImageJPEGRepresentation(@image_view.image, 1)
encodedData = [imageData].pack("m0")
data["image"] = encodedData
BW::HTTP.post("http://localhost:3000/upload}", {payload: data}) do |response|
if response.ok?
end
end
@trek
trek / gist:4154434
Created November 27, 2012 14:18
original notes
https://twitter.com/dagda1/status/231016636847648769
https://twitter.com/garybernhardt/status/227881347346219008/
http://ianstormtaylor.com/rendering-views-in-backbonejs-isnt-always-simple/
backbone: what you'd normally use jquery plugins for, but with an inverted rendering process (js -> DOM instead of DOM -> js)
"islands of richness", jquery data callbacks main pattern.
other frameworks are building out from jQuery's central pattern of DOM selection and event callbacks.
fantastic pattern for adding behavior to documents, but we aren't writing documents.
@rfunduk
rfunduk / autoshot.rb
Created December 4, 2012 21:30
Auto-scp screenshots to a webserver and copy the url to your clipboard (on OSX)
#!/usr/bin/env ruby
# autoshot.rb
#
# Ryan Funduk (ryanfunduk.com)
# Licensed under WTFPL (http://sam.zoy.org/wtfpl)
#
# Watch a directory and scp new files to a host that
# is running a webserver. Only works on OSX, could be
# made to work on other platforms with alternatives
@ivanvanderbyl
ivanvanderbyl / account_routes.js
Last active January 31, 2016 17:55
Using Ember initializers and injections to setup the `currentUser` within your app.
App.AccountEditRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('content', this.get('currentUser'));
}
});
@joefiorini
joefiorini / index.html
Last active December 11, 2015 19:38
A CodePen by Joe Fiorini. Ember.js Stickies
<script type="text/x-handlebars">
<div class="row">
<div class="twelve columns">
<h1>Ember Stickies</h1>
{{outlet}}
</div>
</div>
</script>
<script type="text/x-handlebars" data-template-name="notes">
$ ->
window.BR ||= {}
BR.userListWidget = new BR.UserListWidget $('#user-list'),
length: 20
$nonpareille: 8px!default;
$minion: 9px!default;
$petit: 11px!default;
$bourgeois: 12px!default;
$long-primer: 13px!default;
$small-pica: 15px!default;
$pica: 16px!default;
$english: 19px!default;
$columbian: 21px!default;
$great-primer: 24px!default;
@jorendorff
jorendorff / diff.py
Last active January 12, 2023 04:52
A primitive `diff` in 50 lines of Python. Explained here: http://pynash.org/2013/02/26/diff-in-50-lines.html
""" Usage: python diff.py FILE1 FILE2
A primitive `diff` in 50 lines of Python.
Explained here: http://pynash.org/2013/02/26/diff-in-50-lines.html
"""
def longest_matching_slice(a, a0, a1, b, b0, b1):
sa, sb, n = a0, b0, 0
runs = {}
@chrishunt
chrishunt / Gemfile
Last active December 16, 2015 00:28
Fake service for testing
source 'https://rubygems.org'
gem 'foreman'
gem 'sinatra'
@maxim
maxim / rails_load_path_tips.md
Last active January 9, 2025 00:59
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/