Skip to content

Instantly share code, notes, and snippets.

View jrthib's full-sized avatar
🎸

Joseph Thibeault jrthib

🎸
View GitHub Profile
@jrthib
jrthib / gist:6597754
Last active December 23, 2015 06:59
Sample server.js
// Load configurations
var env = process.env.NODE_ENV || 'development'
, config = require('./config/config')[env];
// Bootstrap db connection
mongoose.connect(config.db);
relations.use(relations.stores.redis, {client: redis.createClient(config.redis.port, config.redis.host)});
// Setup App Version
@jrthib
jrthib / gist:6597718
Created September 17, 2013 17:34
Sample NodeJS App Config
module.exports = {
development: {
root: require('path').normalize(__dirname + '/..'),
app: {
name: 'AppName Development',
nodefly: 'AppName Dev',
iosversion: "2.0.0",
androidversion: "0.6.0"
},
db: 'mongodb://localhost/appdev',
$('.bxslider').bxSlider({
pagerCustom: '#bx-pager',
mode: 'horizontal',
startSlide: 0,
controls: 'false',
onSlideAfter: function($slideElement, oldIndex, newIndex) {
var newClass = $slideElement.attr('class');
var oldClass = $('.bxslider li')[oldIndex].attr('class');
@jrthib
jrthib / gist:6150941
Last active December 20, 2015 14:59
Setting the body class to whichever element is clicked
$('.nav li a').click(function() {
// remove the extra classes before adding the current clicked class
$('.nav li a').each(function(i, el) { // iterate through all of the menu items
// get the current elements class
var removeClass = $(el).attr('class');
// remove it from the body, if it has the class.
if($('body').hasClass(removeClass)) $('body').removeClass(removeClass);
});
<?php
/**
* Page Template
*
* …
*
* @package Thematic
* @subpackage Templates
*/
@jrthib
jrthib / gist:5889118
Created June 29, 2013 00:31
Stop execution of code on browser width
$(window).resize(function() {
var w = $(window).width();
if(w > 1024) {
fixDivsHeight();
} else {
// do whatever mobile wants here...
}
});
function fixDivsHeight() {
@jrthib
jrthib / AzureStorage.js
Created June 25, 2013 04:30
NodeJS Photo Upload with Azure Storage
exports.addCarPhoto = function(req, res) {
var userID = req.user._id;
var carsBaseURI = "http://sobrioapp.blob.core.windows.net/cars/";
// setup photo meta data
var type = req.files.photo.type;
var filename = req.params.id + "-" + req.files.photo.name;
var path = req.files.photo.path;
@jrthib
jrthib / ParallaxRowMustache.html
Last active December 17, 2015 15:29
Parallax Row Mustache Template
<section id="{{ID}}" class="parallax">
<div class="container">
<div class="col span_7">
<h1>{{&section_title}}</h1>
<p>{{paragraph}}</p>
<p class="more"><a href="{{link_to}}" class="button">{{button}}</a></p>
</div>
</div>
</section>
@jrthib
jrthib / ParallaxRowStaticHTML.html
Last active December 17, 2015 15:29
Parallax Row Static HTML
<section id="efficiencyIncluded" class="parallax">
<div class="container">
<div class="col span_7">
<h1>Efficiency <span>Included</span></h1>
<p>Advanced technology to connect healthcare providers and drive EFFICIENCY.</p>
<p class="more"><a href="#" class="button">Find Out More</a></p>
</div>
</div>
</section>
@jrthib
jrthib / gist:5545787
Created May 9, 2013 05:47
Sample NodeJS MongoDB model
var mongoose = require('mongoose')
, Schema = mongoose.Schema
, crypto = require('crypto')
/**
* User Schema
*/
var UserSchema = new Schema({
createdAt: { type: Date, default: Date.now, required: true },