Skip to content

Instantly share code, notes, and snippets.

@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;
@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 / 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: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 / .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: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 / ConditionalView.cs
Last active December 16, 2019 16:56
A WPF control that creates its content based on the value of some property in DataContext. This is great when you have a property like "Status" and want to display a particular control for each status.
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Markup;
namespace Wpf
{
/// <summary>
/* @flow */
import React from 'react'
import { Header } from 'react-navigation'
import { View, StyleSheet } from 'react-native'
import NavBackButton from './NavBackButton'
import StatusBarSpacer from '../components/StatusBarSpacer'
const styles = StyleSheet.create({
root: {
// @flow
/*
A simple spacer component to give room for the status bar.
Thanks to https://github.com/jgkim/react-native-status-bar-size/blob/master/StatusBarSizeIOS.js
*/
/* eslint-disable react-native/split-platform-components */
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { View, StatusBar, StatusBarIOS, NativeModules, Platform, StyleSheet } from 'react-native'
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->