Skip to content

Instantly share code, notes, and snippets.

View charltoons's full-sized avatar
🔆

Charlton Roberts charltoons

🔆
View GitHub Profile
@charltoons
charltoons / Google Places Object Parse
Created November 6, 2012 02:52
Parses a Google Javascript API place object into a usable form
//change google address into something we can use
function parseAddress(addr){
var newAddr = {};
for (var i=0; i<addr.length; i++){
switch (addr[i].types[0]){
case "street_number":
newAddr.street_number = addr[i].long_name;
break;
case "route":
newAddr.street_name = addr[i].long_name;
@charltoons
charltoons / TomatoFy
Created December 31, 2012 03:21
Adds the Rotten Tomato scores to XFinity
(function loaded($){
//constants
window.constants = {
RTAPIKey: 'YOUR API KEY HERE',
}
//load movies from the page
var movies = $('.bucketLists').children('ul').children('li');
@charltoons
charltoons / import.js
Last active December 14, 2015 18:39
Import.js -- The last javascript file you will ever include in HTML. This small file programmatically includes all of your javascript files, either in the body or the head, according to a config object. See the instructions for more info.
(function(){
var files =
[
/****** Instructions
1) insert the following into your HTML file:
<script type="text/javascript" src="import.js"></script>
2) then populate the following object with the info of your javascript files:
{
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Emscripten-Generated Code</title>
<style>
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
textarea.emscripten { font-family: monospace; width: 80%; }
div.emscripten { text-align: center; }
This file has been truncated, but you can view the full file.
// Note: Some Emscripten settings will significantly limit the speed of the generated code.
// Note: Some Emscripten settings may limit the speed of the generated code.
try {
this['Module'] = Module;
} catch(e) {
this['Module'] = Module = {};
}
// The environment setup code below is customized to use Module.
// *** Environment setup code ***
var ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 'function';
// Note: For maximum-speed code, see "Optimizing Code" on the Emscripten wiki, https://github.com/kripken/emscripten/wiki/Optimizing-Code
// Note: Some Emscripten settings may limit the speed of the generated code.
try {
this['Module'] = Module;
} catch(e) {
this['Module'] = Module = {};
}
// The environment setup code below is customized to use Module.
// *** Environment setup code ***
var ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 'function';
#include <iostream>
#include <stdio.h> /* printf, scanf, puts, NULL */
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
using namespace std;
int main(int argc, char *argv[]) {
srand (time(NULL));
@charltoons
charltoons / Projeqt.com
Created April 8, 2013 18:34
Testing out embeds in Projeqt.com
first_name = "Charlton"
full_name = "#{firs_name} Roberts"
alert(full_name)
@charltoons
charltoons / colorInBetween.js
Created May 6, 2013 02:35
Finds the color in between two colors.
function colorInBetween(color1, color2){
function toNumber(hexStr){ return parseInt('0x'+hexStr); }
function toColorObject(color){
var obj = {};
obj.red = toNumber(color.slice(1,3));
obj.green = toNumber(color.slice(3,5));
obj.blue = toNumber(color.slice(5,7));
return obj;
}
function getAverage(val1, val2){
@charltoons
charltoons / Maintenance Monday OSX
Last active August 29, 2015 14:00
Maintenance Monday - update your shit!
#######################################
############## HOMEBREW ###############
#######################################
printf "\n\n---> Updating Homebrew\n"
# update homebrew
brew update
# update all homebrew packages