Skip to content

Instantly share code, notes, and snippets.

View dhigginbotham's full-sized avatar
😸
happycat

David Higginbotham dhigginbotham

😸
happycat
View GitHub Profile
var AppColors = (function () {
var s;
return {
settings: {
el: $('#btnColor'),
that: $('#currentClass'),
last: $('[name="lastColor"]')
},
init: function () {
s = AppColors.settings;
var HandleSortable = (function () {
var s;
return {
settings: {
box: $('#nestable'),
li: $('.dd-item'),
btn: $('#addAppPage'),
selectBox: $('#appPages'),
removeBtn: $('#removeAppBtn'),
currentItems: []
@dhigginbotham
dhigginbotham / _embed.coffee
Last active December 17, 2015 02:49
here's a little gist to help with loading scripts onto your node.js express app to req.que, for the client to load
scripts = module.exports =
settings:
verbose: false # set this to true to turn on verbosity
internal: true # this will accept an external array, doesn't work yet... intentions are there.
items: [
{src: '/js/lib/ga.js', name: 'ga.js', where: 'head', uri: null, type: 'js', exclude: null}
{src: '//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.no-icons.min.css', name: 'bootstrap.css', where: 'head', uri: null, type: 'css', exclude: null}
{src: '//netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css', name: 'font-awesome.css', where: 'head', uri: null, type: 'css', exclude: null}
{src: '/css/style.css', name: 'style.css', where: 'head', uri: null, type: 'css', exclude: null}
{src: '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', name: 'jquery.js', where: 'foot', uri: null, type: 'js', exclude: null}
@dhigginbotham
dhigginbotham / buttonHandler.js
Last active December 17, 2015 19:19
bootstrap selectbox button display for a webapp ui creator
var buttonHandler = (function () {
var s, b;
return {
settings: {
container: null,
colors: []
},
init: function (container, buttons) {
@dhigginbotham
dhigginbotham / .gitattributes
Created June 4, 2013 21:01
Default .gitattributes provided by Github Windows App
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
@dhigginbotham
dhigginbotham / ajax.coffee
Last active December 18, 2015 02:29
wordpress like unique slugs
# routes for json/ajax calls
App = require "../../models/applications"
ajax = module.exports =
slugCount: (req, res) ->
if req.body? && req.body.slug
App.count slug: new RegExp("^#{req.body.slug}$|^#{req.body.slug}-([1-9]{1}$|[1-4]{1}[0-9]{1}$|50$)"), (err, count) ->
if err?
req.flash "info", type: "error", title: "Ooops", msg: "No count Found"
res.json count
@dhigginbotham
dhigginbotham / db.coffee
Last active December 18, 2015 03:09
tests w/ zombie, expect, mocha in coffeescript: you will need npm i -g zombie npm i -g mocha, gl
mongoose = require "mongoose"
paginate = require('paginate')({
mongoose: mongoose
});
mongoose.set "debug", true
# connection sharing thanks to [connection-sharing mongoose examples](https://github.com/LearnBoost/mongoose/tree/master/examples/express/connection-sharing)
db = global.db = mongoose.createConnection(conf.db.mongoUrl);
trim = (str) -> str.replace(/^\s\s*/, '').replace /\s\s*$/, ''
stripVowelAccent = (str) ->
s = str
rExps = [
/[\xC0-\xC4]/g, /[\xE0-\xE5]/g,
/[\xC8-\xCB]/g, /[\xE8-\xEB]/g,
/[\xCC-\xCF]/g, /[\xEC-\xEF]/g,
/[\xD2-\xD6]/g, /[\xF2-\xF6]/g,
@dhigginbotham
dhigginbotham / app.coffee
Last active December 18, 2015 03:29
easy folder creator dealy
# init required folders
initPath = path.join __dirname, "public", "uploads"
init = require("./config/init").init initPath
@dhigginbotham
dhigginbotham / geo.class.js
Last active December 18, 2015 04:19
HTML5/Javascript WebAPI geolocation class, returns lat, lon to a hidden input you'll need a container div#geoLocation...
var GeoClass = (function () {
var s;
return {
settings: {},
init: function () {
s = this.settings;
this.testGeo();
},
testGeo: function () {
if ("geolocation" in navigator) {