Skip to content

Instantly share code, notes, and snippets.

View ChrisC's full-sized avatar

Chris Cuellar ChrisC

View GitHub Profile
@ChrisC
ChrisC / index.html
Created May 19, 2015 20:45
Search Web App Exercise
<!DOCTYPE html>
<html>
<head>
<title>Work In Progress</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="container" class="v-center">
<header class="text-center">
@ChrisC
ChrisC / a.rb
Created January 10, 2014 01:38
it('should set the offer to accepted when a carrier accepts on a drivers behalf', function (done){
new StateImporter('offers', 'accept', function () {
models.user.findOne({_type : 'Driver'}, function (driver) {
models.offer.findOne({}, function (offer) {
var accept_offer = function (callback) {
request.put('/api/1/offers/accept')
.send({driver_id : driver._id, offer_id : offer._id, accept : 'true', by_proxy : 'true'})
.end(function(err, res) {
callback(null, res.body.jobs);
});
@ChrisC
ChrisC / Network Speed Simulator
Created December 5, 2013 23:00
Simulate Network Speeds on Localhost
#config pipe - KByte/s or MByte/s
sudo ipfwpipe 1 config bw 1MByte/s
#add pipe to port
sudo ipfw add 1 pipe 1 src-port 3000
#delete when finished
sudo ipfw delete 1
@ChrisC
ChrisC / retina-replace.js
Last active December 29, 2015 09:39
Uses a Modernizr utility to detect HighResDisplay and replaces an image with class 'img-retina' with the upscaled image. Use the naming convention of adding '_2x' to the upscaled image (e.g 'img.jpg' & 'img_2x.jpg")
/*********************
RETINA DETECT & IMG REPLACEMENT
*********************/
Modernizr.addTest('highresdisplay', function(){
if (window.matchMedia) {
var mq = window.matchMedia("only screen and (-moz-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)");
if(mq && mq.matches) {
return true;
} else {
return false;
@ChrisC
ChrisC / jsKeyCode.txt
Last active December 17, 2015 03:19 — forked from lbj96347/jsKeyCode.txt
KeyCode jQuery Events & KeyCode List
var keycode = 27; //ESC key
$(document).keypress(function(e) {
if (e.which == keycode) {
//do stuff
}
});
//or, for ESC key
$(document).keyup(function(e) {
@ChrisC
ChrisC / scrollto.js
Created May 2, 2013 21:47
Smoothly Scroll to Element
$('html, body').animate({
scrollTop: $("#elementID").offset().top
}, 2000);