Skip to content

Instantly share code, notes, and snippets.

View parris's full-sized avatar

Parris Khachi parris

  • Discord
  • San Francisco
View GitHub Profile
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'
@parris
parris / .bash_profile
Created November 30, 2012 08:07
Bash_Profile, Colors on mac
#make sure to run: git config --global color.ui true
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\*\1/'
}
case "$TERM" in
xterm-*color) color_prompt=yes;;
esac
@parris
parris / XMLParser.js
Created June 8, 2012 20:31
XML to JS Object (JSON), jQuery/jasmine
function xmlParser(node) {
var i = 0;
var attrs = node.attributes;
var nodes = node.childNodes;
var jsNode = new Object();
for(i;i<attrs.length;i++){
jsNode[attrs[i].name] = attrs[i].value;
}