Skip to content

Instantly share code, notes, and snippets.

@robertsdionne
robertsdionne / deepdream-install.md
Last active February 15, 2021 16:07
Deepdream installation
#!/usr/bin/env bash

# Assuming OS X Yosemite 10.10.4

# Install XCode and command line tools
# See https://itunes.apple.com/us/app/xcode/id497799835?mt=12#
# See https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html
xcode-select --install
@jlongster
jlongster / bloop.js
Last active September 5, 2022 23:33
bloop
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}
@parsley72
parsley72 / keeniolocationmap.html
Last active March 9, 2016 07:34
Very basic demo of how to display Keen.io locations on a Google map. I've left out my Project ID and Read Key (for obvious reasons) so to get it to work you need to replace [PROJECT ID], [READ KEY] and [EVENT COLLECTION] with your own settings. Alternatively, go to the Keen.io Workbench for your project, select the Event Collection, set Analysis…
<!DOCTYPE html>
<html>
<head>
<title>Keen.io location map</title>
<style>
#map-canvas {
min-height: 400px;
width: 100%;
@wetzler
wetzler / gist:6816497
Last active December 24, 2015 14:59
Here's how you can get query results for two Keen IO series, in parallel, and then combine them in one multiline chart.I really want to rewrite this to run N queries at a time, but this works for now.
Keen.configure({
projectId: id,
readKey: key
});
// Timeframe parameters for queries
var timeframe = "last_14_days"
var interval = "daily"
Keen.onChartsReady(function(){
@sgammon
sgammon / base64.js
Last active December 17, 2015 05:59
/*
*
* Base64 for JavaScript
* -- A clean and compact implementation --
*
* @author Sam Gammon <sg@samgammon.com>
*/
(function (context) {
var Base64 = context.Base64 = {
@anantn
anantn / firebase_create.js
Last active November 20, 2023 23:17
Firebase: Creating data if it doesn't exist. This snippet creates a user only if it doesn't already exist.
function go() {
var userId = prompt('Username?', 'Guest');
var userData = { name: userId };
tryCreateUser(userId, userData);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userCreated(userId, success) {
if (!success) {
@anantn
anantn / firebase_detect_data.js
Created December 18, 2012 00:54
Firebase: Detecting if data exists. This snippet detects if a user ID is already taken
function go() {
var userId = prompt('Username?', 'Guest');
checkIfUserExists(userId);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userExistsCallback(userId, exists) {
if (exists) {
alert('user ' + userId + ' exists!');
@nrrrdcore
nrrrdcore / inset_input.css
Created August 9, 2012 23:35
The Perfect Inset Input CSS
input {
height: 34px;
width: 100%;
border-radius: 3px;
border: 1px solid transparent;
border-top: none;
border-bottom: 1px solid #DDD;
box-shadow: inset 0 1px 2px rgba(0,0,0,.39), 0 -1px 1px #FFF, 0 1px 0 #FFF;
}
@penguinboy
penguinboy / Object Flatten
Created January 2, 2011 01:55
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;