Skip to content

Instantly share code, notes, and snippets.

@StevePotter
StevePotter / gist:603b366873bb99fd8afd
Created September 3, 2014 13:30
A mixin for bootstrap react that adds validation and value conversion to forms.
//use this mixin to get validation support and some helpful input functions
FormMixin = {
autoHandleChange: function(field, e)
{
var value = (this.refs[field] && this.refs[field].getValue) ? this.refs[field].getValue() : e.target.value;
stateUpdate = {}
stateUpdate[field] = value
this.setState(stateUpdate, function() {
stateUpdate = {}
stateUpdate[field + "Error"] = this.validateSingle(field)
@StevePotter
StevePotter / .gitignore for .net
Created February 4, 2013 14:57
Here's the .gitignore I've compiled for my .net projects. Most of it is taken from a project somewhere else on github but I made some tweaks.
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@StevePotter
StevePotter / gist:4347860
Created December 20, 2012 19:14
jquery validator global settings for twitter bootstrap horizontal forms
$.validator.setDefaults({
highlight: function(label) {
return $(label).closest(".control-group").addClass("error");
},
success: function(label) {
return label.hide().closest(".control-group").removeClass("error");
},
errorClass: "help-inline",
validClass: ""
});
@StevePotter
StevePotter / git-heroku
Created December 20, 2012 19:11
For very lazy devs using git with heroku and want to commit and push some changes to heroku they just made. I saved this as /usr/bin/git-heroku. It takes a single parameter, which is the commit message.
#! /bin/bash
git add .
git commit -m "$1"
git push heroku master
@StevePotter
StevePotter / gist:4041281
Created November 8, 2012 20:17
cake task for precompiling jade templates using clientjade
{exec} = require 'child_process'
chokidar = require('chokidar')
fs = require 'fs'
task 'build:templates:watch', 'in /templates continually precompile jade templates into public/templates.js', (options) ->
console.log options
watcher = chokidar.watch "templates",
ignored: (name) -> false
persistent: true
compile = ->
@StevePotter
StevePotter / UIDeviceHardware.h
Created March 29, 2012 15:26 — forked from Jaybles/UIDeviceHardware.h
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;