Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt McCray mattmccray

  • Elucidata unLTD
  • Dallas, TX
View GitHub Profile
@mattmccray
mattmccray / sftp.thor.rb
Created Jul 26, 2008
Thor task for sftp syncing
View sftp.thor.rb
# module: sftp
# A generic Thor module for sftp syncing.
#
# 1. Call `thor sftp:setup` to create config file.
# 2. Edit the config file
# 3. Call `tor sftp:sync` start the sync
#
# Ze end.
View graphic-novelist.js
//
// Graphic Novelist (graphic-novelist.js)
// Created by M@ McCray
// site: http://mattmccray.com
// email: matt at elucidata dot net
//
// API:
//
// GraphicNovelist.parse( text ) -> Parse text into array of script Nodes
// GraphicNovelist.renderNodes( nodes ) -> Renders array of script Nodes into HTML
View documents.js
// Document Model
dc.model.Document = Backbone.Model.extend({
constructor : function(attrs, options) {
attrs.selected = false;
attrs.selectable = true;
if (attrs.annotation_count == null) attrs.annotation_count = 0;
Backbone.Model.call(this, attrs, options);
var id = this.id;
@topfunky
topfunky / duration.coffee
Created Aug 31, 2011
A custom Batman.js filter
View duration.coffee
# Transform an integer number of seconds as hours and minutes: 1:45
#
# Put in filters/duration.coffee and do @require('filters', 'duration')
Batman.Filters.formatSecondsAsTime = (value) ->
seconds = parseInt value, 10
return '' unless seconds
hours = parseInt seconds / 60 / 60, 10
minutes = parseInt (seconds / 60) % 60, 10
hours = '' unless hours > 0
minutes = '0' + minutes if minutes < 10
anonymous
anonymous / 1_gridComponent.js
Created Feb 22, 2013
Grid Component
View 1_gridComponent.js
App.module("Dashboard", function(Dashboard, App, Backbone, Marionette, $, _){
"use strict";
var Comp = {};
// Grid Table Structure
// --------------------
Comp.GridRow = Marionette.ItemView.extend({
tagName: "tr"
@jdonaldson
jdonaldson / hxn.sh
Last active Dec 15, 2015
Simple bash script for switching between haxe nightly and stable
View hxn.sh
export OLDPATH=$PATH
export HAXE_NIGHTLY=$HOME/bin/haxe_nightly
hxn(){
if [ -z "$USE_HAXE_NIGHTLY" ] || $USE_HAXE_NIGHTLY; then
echo "Changing to Haxe stable version"
export HAXE_STD_PATH=$OLD_HAXE_STD
export PATH=$OLDPATH
export USE_HAXE_NIGHTLY=false
else
echo "Changing to Haxe nightly at: $HAXE_NIGHTLY"
@kgn
kgn / FadeScrollView.h
Created Jul 26, 2012 — forked from MaximKeegan/FadeScrollView.h
Fade edges UIScrollView
View FadeScrollView.h
#import <UIKit/UIKit.h>
@interface SNFadeScrollView : UIScrollView
@property (nonatomic) BOOL fadeTop;
@property (nonatomic) BOOL fadeBottom;
@end
@mweststrate
mweststrate / typeswitcher.ts
Created Apr 14, 2016
(TypeScript) typeswitcher, like switch, but with constructor based cases and expressions with inferred types
View typeswitcher.ts
/**
* Usage:
typeSwitch(someInstance, defaultvalue)
.when(MyClass, i => result)
.when(OtherClass, i => otherResult)
.get()
In the expressions, the type of the 'i' param should be inferred correctly, see the attribute default value checks
*/
export function typeSwitch<T, R>(instance: T, defaultValue?: R): TypeSwitcher<T, R> {
View readme.md
@leemeichin
leemeichin / README.md
Created Oct 9, 2012
Apply Standard Competition Rankings to your leaderboard
View README.md

Standard Competition Rankings

This class makes it easier to generate a leaderboard that complies with the Standard Competition Ranking system. That is, it takes joint/tied positions into account, and adjusts the positions accordingly.

Take the following list of users and points for example:

User    | Points
1         35
2 35