Skip to content

Instantly share code, notes, and snippets.

View dhigginbotham's full-sized avatar
😸
happycat

David Higginbotham dhigginbotham

😸
happycat
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div ng-app="timepickerDemoApp">
<div ng-controller="timepickerDemoController">
function buildTimes() {
var times = [];
for (var i=-1;i<23;++i) {
var idx = (i+1);
var ampm = (idx>12 ? 'pm' : 'am');
var time = (idx>12 ? idx%12 : (idx>0 ? idx : 12));
if (idx==24) time = 12;
var t = time + ':00' + ampm;
times.push(t);
}
mixin pagination(current, total, limit)
- limit = limit || 40;
- current = current+1;
- total = Math.ceil(total / limit);
- prev = (current <= 1 ? 1 : current);
- next = (current + 1);
ul.pagination.pagination-sm
li: a(href="?page=#{prev}") «
- for(var i=0;i<total;++i)
@dhigginbotham
dhigginbotham / mocha-request-test.js
Last active August 29, 2015 14:03
simple example of server side requests in node.js
var request = require('./request'),
expect = require('expect.js');
describe('Request Library Test Suite', function() {
it('should be able to handle a GET request to github', function(done) {
var opts = {
url: 'https://api.github.com/users/dhigginbotham',
headers: {
'User-Agent': 'dhigginbotham',
@dhigginbotham
dhigginbotham / shared.js
Created July 3, 2014 19:06
example - share some variables to your templates in express...
//
// Shared Variables Middleware
// ---------------------------
// will get passed to app.locals
//
// Usage:
// app.use(require('./path/to/file'));
//
// require dependencies
.button(@btn-color: @brand-primary, @text-color: @light) {
border: 1px solid darken(@btn-color, 13%);
border-top-color: darken(@btn-color, 7%);
border-left-color: darken(@btn-color, 7%);
padding: 4px 12px;
color: @text-color;
display: inline-block;
font-size: 11px;
font-weight: bold;
text-decoration: none;
@dhigginbotham
dhigginbotham / elemental.js
Last active August 29, 2015 14:01
make an html element with pojo
(function (root, doc) {
// var schema = {
// target: 'elementalTarget',
// method: 'append',
// type: 'div',
// className: 'elemental-default',
// data: {
// elemental: 'div'
// },
@dhigginbotham
dhigginbotham / older-cs.coffee
Last active August 29, 2015 14:01
simple express rest app... yeah.
_ = require "lodash"
rest = (opts) ->
# simple prefix, ie http://localhost:1337/api/:collection/:id?
@prefix = '/api'
@path = null
@key = 'collection'