Skip to content

Instantly share code, notes, and snippets.

View parris's full-sized avatar

Parris Khachi parris

  • Discord
  • San Francisco
View GitHub Profile
@parris
parris / mocha.opts
Created August 4, 2014 04:17
ReactJS Mocha.opts
--require should
--reporter dot
--ui bdd
--debug
--compilers coffee:coffee-react/register
--recursive
define(function(require) {
var Backbone = require(‘backbone’),
backboneCanvasMixin = require(‘components/shapes/mixins/backbone_raphael_mixin’),
isMovable = require(‘components/shapes/mixins/is_movable’)
isRotatable = require(‘components/shapes/mixins/is_rotatable’)
// … and more ;
return Backbone.View.extend({ … })
.mixin(backboneCanvasMixin)
define(function(require) {
'use strict';
require('stickit');
return function(options){
// NOTE: this assumes inputs
var bindingDefaults = {
events: ['blur', 'paste', 'change'],
onSet: 'onSet'
@parris
parris / backbone_raphael_mixin.js
Created June 3, 2014 20:20
Mixes into Backbone.View to provide Raphael based views
define(function(require) {
// forked from https://github.com/tomasAlabes/backbone.raphael
'use strict';
function addMixin(mixinOptions) {
this.clobber({
setElement: function (element, delegate, undelegateEvents) {
if (this.el && undelegateEvents) {
this.undelegateEvents();
@parris
parris / button_3d.scss
Created June 1, 2014 08:44
3d button using Bourbon with animations. Demo Here: http://codepen.io/anon/pen/Czlvu
@import '../libs/bourbon/css3/_inline-block';
@import '../libs/bourbon/css3/_transition';
@import '../libs/bourbon/css3/_transform';
@import '../globals';
@mixin flat3DButton($color) {
$inverted_color: invert(mix(invert($color), $color, 25%));
@include inline-block();
@parris
parris / mixable.coffee
Created April 28, 2014 09:52
(We now have a repo/npm package: https://github.com/parris/mixablejs) Mixin class for coffeescript. Based on Angus Croll style mixins and backbone.advice.
_ = require('lodash')
class Mixable
constructor: ->
@initialize()
initialize: ->
@addToObj: (objectName, dictionary) ->
###
Listens for clicks on a tags, if relative and the target is not blank it will use pushState
otherwise we fall through to normal click handling. Note preventDefault might need to be
handled better in older browsers.
###
hijackRelativeURLs = ->
document.addEventListener('click', (e) ->
element = e.target
if element?.nodeName == 'A'