Skip to content

Instantly share code, notes, and snippets.

@tkh44
tkh44 / responsive2column.css
Created February 19, 2013 19:35
responsive layout based on "this is responsive"
/* ==========================================================================
Layout Styles
========================================================================== */
.left-col-wrapper {
}
.inner-left-col {
padding: 0 1em;
}
groupAndSortRooms: function(collection) {
var startOfWeek = moment().startOf('week');
var endOfWeek = moment().endOf('week');
var startOfNextWeek = moment().add('w', 1).startOf('week');
var endOfNextWeek = moment().add('w', 1).endOf('week');
var thisWeekFormat = 'This Week ' + startOfWeek.format('MM/DD') + '-' + endOfWeek.format('MM/DD');
var nextWeekFormat = 'Next Week ' + startOfNextWeek.format('MM/DD') + '-' + endOfNextWeek.format('MM/DD');
var groupedData = {};
if (!collection.length) {
@tkh44
tkh44 / MyReservations.js
Created August 9, 2013 20:59
renderTime
renderTimeBlocks: function(timeBlocks, cb) {
var self = this,
startOfWeek = moment().startOf('week'),
endOfWeek = moment().endOf('week'),
startOfNextWeek = moment().add('w', 1).startOf('week'),
endOfNextWeek = moment().add('w', 1).endOf('week'),
thisWeekFormat = 'This Week ' + startOfWeek.format('MM/DD') + '-' + endOfWeek.format('MM/DD'),
nextWeekFormat = 'Next Week ' + startOfNextWeek.format('MM/DD') + '-' + endOfNextWeek.format('MM/DD'),
timeBlockKeys = ['Today', thisWeekFormat, nextWeekFormat, 'Upcoming'];
@tkh44
tkh44 / MakeReservation.js
Created August 12, 2013 20:34
moment is beautiful
updateDateInputValues: function(e) {
var $start = $(e.currentTarget),
$end = $('input[name="endDate"]'),
startDate = moment($start.val(),'YYYY-MM-DD'),
endDate = moment($end.val(), 'YYYY-MM-DD');
while(endDate.isBefore(startDate) || endDate.isSame(startDate)) {
endDate.add('d', 1);
}
@tkh44
tkh44 / MakeReservation.js
Created August 14, 2013 21:06
How mast should extend
Mast.extend('Base', 'Extended', function(){return {
blah: function() {
console.log('adkfdfd');
}
}});
@tkh44
tkh44 / Login.js
Created August 15, 2013 00:22
Subscribe to all subreddits in a multireddit link
(function getMahSubreddits(a) {
var myReddits = a.split('/r/')[1].split('+');
myReddits.forEach(function(s) {
$.get('http://reddit.com/r/'+s+'/about.json')
.success(function(data) {
var name = data.data.name;
console.log(name);
subscribe(name);
});
})
@tkh44
tkh44 / ContactsCollection.js
Last active December 21, 2015 09:58
Used instead of sync to pull local contacts.
getContacts: function(filter, cb) {
var fields = ['name', 'emails'],
options = new ContactFindOptions(),
callback = cb || $.noop,
self = this;
options.filter = filter || '';
options.multiple = true;
this.reset();
@tkh44
tkh44 / _global.less
Created August 21, 2013 18:02
Fixed Header in PhoneGap app
region[default="App"] {
width: 100%;
height: 100%;
region[default="AppHeader"] {
width: 100%;
z-index: 12;
}
@tkh44
tkh44 / gist:6343624
Last active December 21, 2015 17:58
parse: function (events, options) {
var eventKeys = _.keys(events || {}),
limitEvents,
parsedEvents = [];
// Optionally filter using set of acceptable event types
limitEvents = options.only;
eventKeys = _.filter(eventKeys, function checkEventName (eventKey) {
@tkh44
tkh44 / gist:6346531
Created August 26, 2013 20:53
Less button magic
//Variable
@hLBlue: #0e9ccf;
// Flat Button Mixin
.btn-flat (@color: @lightGray) {
border: solid 1px darken(@color, 10%);
background-color: @color;
.btn-defaults ();
&:disabled {