Skip to content

Instantly share code, notes, and snippets.

View mikekavouras's full-sized avatar

Mike Kavouras mikekavouras

View GitHub Profile
$(document).ready(function() {
var name = "dolphinhood";
var apiKey = "B9enqZ1SESmqJ6NNbRuUcdj7nMDm9Vu8HI4zBhzsc7OLI5yZTz";
// Boot up our TumblrMachine
var tumblr = new TumblrMachine(name, apiKey);
// Fetch the first set (20) of posts
tumblr.fetchPosts(function(posts) {
var data = {
"result": {
"lat": "40.693219",
"lng": "-73.989998",
"trains": [
{
"direction": 3,
"scheduled_track": "2",
"arrival_time": "2014-09-04T15:20:30-04:00",
"train_id": "02 1408 241/FLA",
function gimmeDatJSON(callback) {
$.getJSON(geourl, function(response) {
callback(response);
});
}
function processResponse(response) {
var lat = response.results[0].geometry.location.lat;
var lng = response.results[0].geometry.location.lng;
function signup(successCallback) {
$.ajax({
url: 'http://signup.com',
type: 'post',
data: {username: "butt"},
success: function(response) {
successCallback(response.user);
},
error: function() {
alert('well...');
// API
function Wemo(devices) {
this.devices = devices;
this.baseURL = "http://localhost:5000/api/device/";
this.state = {}
this.checked = 0;
this.resetState();
<div class="related-background">
<div class="wrapper">
{% comment %}
A snippet to include related products on a product single page.
More information:
- http://docs.shopify.com/support/your-store/products/can-i-recommend-related-products
{% endcomment %}
{% assign number_of_related_products_to_show = 4 %}
var name = "reuters";
var key = "2W5eRXOm7i0ZpdlEKi3g2G6wCAOJsTBpJ45aenzuNGikak9tl2"
t = new TumblrMachine(name, key, false, function(collection, isLast) {
var post = collection._posts[0].body;
var div = document.getElementsById('tumblr-post');
body.innerHTML = post;
});
var key = "2W5eRXOm7i0ZpdlEKi3g2G6wCAOJsTBpJ45aenzuNGikak9tl2"
var name = "reuters"
t = new TumblrMachine(name, key, false, function(collection, isLast) {
var post = collection.posts()[0];
var content = post.content();
$('#photos').html(content);
});
@mikekavouras
mikekavouras / Color @ %
Created March 11, 2015 21:08
Get the color at a specific % between 2 colors
class func colorAtPercentage(color1: UIColor, color2: UIColor, perc: CGFloat) -> UIColor {
let firstComp = CGColorGetComponents(color1.CGColor)
let secondComp = CGColorGetComponents(color2.CGColor)
let red1 = firstComp[0]
let red2 = secondComp[0]
let newRed = numbers(red1, num2: red2, perc: perc)
let green1 = firstComp[1]