Skip to content

Instantly share code, notes, and snippets.

View fourcolors's full-sized avatar
🎯
Perkisizing

fourcolors fourcolors

🎯
Perkisizing
View GitHub Profile
@fourcolors
fourcolors / todo.html
Created June 27, 2014 06:43
ReactJS Breaking with No Div
<!DOCTYPE html>
<html>
<head>
<script src="react.js"></script>
<script src="transformer.js"></script>
</head>
<body>
<div id="component"></div>
<script type="text/jsx">
/** @jsx React.DOM */
@fourcolors
fourcolors / todo.html
Created June 27, 2014 06:17
Todo List Application
<html>
<head>
<script src="react.js"></script>
<script src="transformer.js"></script>
</head>
<body>
<div id="component"></div>
<script type="text/jsx">
/** @jsx React.DOM */
@fourcolors
fourcolors / app.js
Created December 20, 2013 03:50
express app to host originate-ember. Be sure to add express and ejs to your package.json
/**
* Module dependencies.
*/
var express = require('express');
var http = require('http');
var path = require('path');
var app = express();
@fourcolors
fourcolors / rev.css
Created October 3, 2013 19:33
Styles and html structure for the WikiPagesRevisions sidebar
.revision {
width: 70%;
}
.revisions {
min-width: 300px;
width: 25%;
height: 100%;
border: 1px solid #c1c7d0;
background-color: #f6f8fa;
@fourcolors
fourcolors / .zshrc
Created July 17, 2013 21:17
Alias for Canvas Javascript Tests. Use this like this. js_dev WikiPageEditViewSpec or js_test WikiPageEditViewSpec That should run only tests in that specific file.
js_dev(){
JS_SPEC_MATCHER="**/*$*.js" bundle exec rake js:dev
}
js_test(){
JS_SPEC_MATCHER="**/*$*.js" bundle exec rake js:test
}
{create: ‘POST’, update: ‘PUT’, destroy: ‘DELETE’}
@fourcolors
fourcolors / nestedAttribute.coffee
Created April 9, 2013 20:10
Allow nested attributes on a backbone model
# Example usage
# @model.setNestedAttribute parent: 'foo', property: 'bar', value: 'catz', silent: true
setNestedAttribute: (options) ->
parent = options.parent
value = options.value
property = options.property
silent = options.silent
date_data = @get(parent) || {}
date_data[property] = value
@fourcolors
fourcolors / JavascriptModuleFunction.js
Last active December 14, 2015 00:29
Creating some examples for my bog.
(function(){
console.log("Module scoped function");
})();
# Extends Backbone.View on top of itself with some added features
# we use regularly
class Backbone.View extends Backbone.View
##
# Manages child views and renders them whenever the parent view is rendered.
# Specify views as key:value pairs of `className: view` where `className` is
# a CSS className to find the element in which to to append a rendered
# `view.el`
#
@fourcolors
fourcolors / gist:4050235
Created November 10, 2012 06:55
Backbone model override
# Method Summary
# Before a request gets sent out we need to make sure
# it's formatted correctly and contains the right
# info. We are adding the CSRF tokens in the header
# so our POST request work and making sure any
# namespaced attributes are working so the server is
# happy. If we are using other AJAX request to post
# date we will have to add something for jQuery.
preProcessSync: ->
# Fix backbone headers