Skip to content

Instantly share code, notes, and snippets.

View datapimp's full-sized avatar

Jonathan Soeder datapimp

View GitHub Profile

Smooth

An automatically syncing ORM that works the same on the client and the server, with libraries for Ruby, Javascript, and Objective C. The adapter for rails and active record provide you with a free JSON API out of the box.

Smooth contains a model / collection library that works on both the server and the client to automatically stay in sync, and eliminate the need to write glue code. A Smooth Data source can be configured from the browser.

require 'models/user_attributes'
require 'json'
require 'app_config'
require 'fileutils'
class TrackingLog
class << self
def truncate_all
Dir.glob(File.join(TrackingLog.dir, "tracking*log")).each do |path|
FileUtils.rm(path)
//http://theint.ro/blogs/outro/4686992-responsive-design-with-sass
@mixin respond-to($media) {
@if $media == small {
@media screen and (max-width: 420px) {
@content
}
}
@else if $media == medium {
@media screen and (max-width: 768px) {
@content
class Application.App extends Backbone.Events
constructor: (@options={})->
_.extend(@, @options)
@setupViewport()
@user = new Application.models.User()
onUserIdentified: ()->
@datapimp
datapimp / tmux.conf
Created June 25, 2013 07:47
tmux config.
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
setw -g xterm-keys on
set-option -g default-terminal "screen-256color"
set -g display-time 3000
set -g history-limit 65535
set -g base-index 1
SampleView = Backbone.View.extend
events:
"click h1" : ()->
alert 'sup'
initialize:()->
Backbone.View::initialize.apply(@, arguments)
@setElement("#demo")
window.sampleView = new SampleView()
var color = function(e){
var $target = $(e.target);
$target.css({
'background-color': '#9FC4E7',
opacity: .5
})
$target.children().each(function(i,el){
$(el).css({
%table
%tbody
= render(:partial=>"job_applications/partials/table_row",:collection=>@job_applications,:as => :application)
@datapimp
datapimp / gist:5401319
Created April 17, 2013 02:22
keylauncher.js example
KeyLauncher.onSequence 'sup', ()->
$('.example-wrapper').append '<h4>Sup...</h4>'
$('.example-wrapper').append '<p><strong>Now type ctrl+j</strong></p>'
KeyLauncher.on 'ctrl+j', ()->
if _.isObject(Backbone)
View = Backbone.View.extend
className: 'modal fade hide'
render: ()->
@datapimp
datapimp / gist:5391716
Created April 15, 2013 22:15
class DefaultPolicy attr_accessor :product def initialize product @Product = product end def whatever "bro" end end class CuratedSelect < DefaultPolicy def description "Fooda Select: Curated Menu" end end # lib/fooda/policies/perks_policy.rb class PopupPolicy < DefaultPolicy def description "Fooda Popup" end end class Offering delegate :descript…
class DefaultPolicy
attr_accessor :product
def initialize product
@product = product
end
def whatever
"bro"
end