This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Element.prototype.hasClass = function (className) { | |
return new RegExp(' ' + className + ' ').test(' ' + this.className + ' '); | |
}; | |
Element.prototype.addClass = function (className) { | |
if (!this.hasClass(className)) { | |
this.className += ' ' + className; | |
} | |
return this; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Smartphones (portrait and landscape) ----------- */ | |
@media only screen | |
and (min-device-width : 320px) | |
and (max-device-width : 480px) { | |
/* STYLES GO HERE */ | |
} | |
/* Smartphones (landscape) ----------- */ | |
@media only screen | |
and (min-width : 321px) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var httpRequest; | |
if (window.XMLHttpRequest) { | |
httpRequest = new XMLHttpRequest(); | |
} else if (window.ActiveXObject) { | |
// Internet Explorer | |
httpRequest = new | |
ActiveXObject("Microsoft.XMLHTTP"); | |
} | |
httpRequest.onreadystatechange = function () { | |
if (httpRequest.readyState === 4 && httpRequest.status === 200) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Calculate Scroll Speed | |
var lastOffset = $(window).scrollTop(); | |
var lastDate = new Date().getTime(); | |
$(window).scroll(function(e) { | |
var delayInMs = e.timeStamp - lastDate; | |
var offset = scrollTopValue - lastOffset; | |
var speedInpxPerMs = offset / delayInMs; | |
var scrollSpeed = Math.abs(speedInpxPerMs.toFixed(2)); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function offsetCenter(map, latlng, offsetx, offsety) { | |
// latlng is the apparent centre-point | |
// offsetx is the distance you want that point to move to the right, in pixels | |
// offsety is the distance you want that point to move upwards, in pixels | |
// offset can be negative | |
// offsetx and offsety are both optional | |
var scale = Math.pow(2, map.getZoom()); | |
var nw = new google.maps.LatLng( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var GithubAPI = Meteor.require('github'); | |
var ghapi = new GithubAPI({version: "3.0.0"}); | |
function getUserProfile(req, callback) { | |
ghapi.user.getFrom(req, callback); | |
} | |
var wrappedGetProfile = Meteor._wrapAsync(getUserProfile); | |
Meteor.methods({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in /lib needed on both client and server | |
var throwError = function(error, reason, details) { | |
error = new Meteor.Error(error, reason, details); | |
if (Meteor.isClient) { | |
return error; | |
} else if (Meteor.isServer) { | |
throw error; | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/bundle/programs/server/npm | |
rm -rf npm-bcrypt/node_modules/bcrypt | |
npm install [email protected] |
OlderNewer