Skip to content

Instantly share code, notes, and snippets.

View jshaw's full-sized avatar
🤖
👨‍🎨 👨‍💻

Jordan Shaw jshaw

🤖
👨‍🎨 👨‍💻
View GitHub Profile
@jshaw
jshaw / particle_iceland_bike_example
Created November 20, 2015 20:23
particle iceland bike example
// http://apis.is/cyclecounter
// particle webhook GET ice_bikes "http://apis.is/cyclecounter"
// Jordans-MacBook-Pro:~ jshaw$ particle webhook GET ice_bikes "http://apis.is/cyclecounter"
// Sending webhook request { uri: 'https://api.particle.io/v1/webhooks',
// method: 'POST',
// json:
// { event: 'ice_bikes',
// url: 'http://apis.is/cyclecounter',
// deviceid: undefined,
@jshaw
jshaw / index.html
Created February 20, 2015 21:56
Google Streetview Example
<!DOCTYPE html>
<html>
<head>
<title>Custom Street View panorama tiles</title>
<meta charset="utf-8">
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
@jshaw
jshaw / heapsort.js
Last active August 29, 2015 14:13 — forked from Rosencrantz/heapsort.js
var list = [9,1,7,3,4,2,8,0,5,6];
function chunk(list) {
var chunks = [];
for(var i=0; i<list.length; i++) {
if(list.length % 2 == 1 && i+1 == list.length) {
chunks.push(list[i]);
} else {
if(i % 2 == 0) {
chunks.push(Math.max(list[i], list[i+1]));
@jshaw
jshaw / tourney.html
Last active August 29, 2015 14:13 — forked from sterlingwes/tourney.html
<!DOCTYPE html>
<html>
<head>
<title>Tournament Bracket Generator</title>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://underscorejs.org/underscore-min.js"></script>
<script>
$(document).on('ready', function() {
var knownBrackets = [2,4,8,16,32], // brackets with "perfect" proportions (full fields, no byes)
/*
Navigation scroll to anchor w/ URL routing using pushstate
*/
(function () {
var global = this;
// Initial setup
@jshaw
jshaw / js_template.html
Created August 26, 2014 21:26
example javascript templates using underscore.js templating
<!--Example JS template-->
<script type="text/template" id="PastCommunityTemplate">
<img class="pvs-cmy-img" src="<%= thumbnail %>" alt="<%= name %>">
<h3 class="pvs-cmy-title"><%= name %></h3>
<h4 class="pvs-cmy-city">City: <%= city %></h4>
<p class="pvs-cmy-description"><%= summary %></p>
</script>
@jshaw
jshaw / eventClick.js
Last active August 29, 2015 14:05
example using underscore binding on events to keep class scope
// When using underscore this passes the class scope into the event handler (callback function)
// rather than having the click event scope in the handler (callback function)
Navigation.prototype._addClickEvent = function () {
var handler = _(this._handleEventClick).bind(this);
this.$nav_items.on('click', handler);
};
// Here this refers to Navigation.prototype rather than the event which gets passed in
Navigation.prototype._handleEventClick = function (evt) {
evt.preventDefault();
@jshaw
jshaw / markdown_cheatsheet
Created April 2, 2014 15:47
markdown cheatsheet
# Header 1 #
## Header 2 ##
### Header 3 ### (Hashes on right are optional)
#### Header 4 ####
##### Header 5 #####
## Markdown plus h2 with a custom ID ## {#id-goes-here}
[Link back to H2](#id-goes-here)
This is a paragraph, which is text surrounded by whitespace. Paragraphs can be on one
@jshaw
jshaw / FBShareExample
Last active June 3, 2022 14:18
Basic FB Share link example that allows custom image url and description for dynamic content. This content would be available in the JS somewhere... like the context.
Core.prototype._initializeFbShare = function() {
$('#Fb-share').on('click', _(this._handleFbShare).bind(this));
};
Core.prototype._handleFbShare = function(event) {
event.preventDefault();
var image_url = this.getPaletteImageUrl(this.picker.config.shade_array);
var palette_name = this.$inputPalName.val();
var lang = document.documentElement.lang;
@jshaw
jshaw / commands
Created May 28, 2013 15:01
terminal command references
Grep
==========
grep -ir "some_string" some_directory
grep -ir --include=*.less "some_string" some_directory