Skip to content

Instantly share code, notes, and snippets.

View imbcmdth's full-sized avatar

Jon-Carlos Rivera imbcmdth

View GitHub Profile
@imbcmdth
imbcmdth / eme.json
Last active August 29, 2015 14:23 — forked from dmlap/eme.json
player.src({
"src": "movie.mpd",
"type":"application/dash+xml",
"keySystemOptions": [
{
"name": "com.widevine.alpha",
"options": {
"licenseUrl": "https://example.com/license"
}
}
var a = 'Going down to brown town';
String.prototype.lerp = function(n){
var ai = Math.floor(n);
var t = n - ai;
var a = this.charCodeAt(ai);
var b = this.charCodeAt(ai + 1);
return String.fromCharCode(a + (b - a) * t);
}
@imbcmdth
imbcmdth / content
Last active December 17, 2015 16:19 — forked from pcamp96/content
var isMobile = {
tests:[
function() {
return navigator.userAgent.match(/Android/i);
},
function() {
return navigator.userAgent.match(/BlackBerry/i);
},
function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
// ==UserScript==
// @name Tatoeba Flexible Linker
// @namespace http://userscripts.org/users/515236
// @description Inserts a box below a Tatoeba sentence that the user can fill with the number or URL of a sentence, as well as buttons that allow the user to visit the new sentence or link it to the first one. Extends Zifre's "Tatoeba Linker" script.
// @author AlanF_US
// @include http://tatoeba.org/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
// @version 1.0
// ==/UserScript==
// NOTE: All functions used in the script must be added to the line below
var width = null;
var height = null;
window.onload = function () {
var windowSize = getSize();
width = windowSize['width'];
height = windowSize['height'];
window.onscroll = function(){ alert("Hello"); }
};
@imbcmdth
imbcmdth / gist:3881651
Created October 12, 2012 21:35
Javascript this quiz
// current scope is global..
function Test(n) {
this.test = n;
var bob = function (n) {
this.test = n;
};
this.fn = function (n) {
var locations = JSON.parse(body);
locations = _.first(locations, 10);
_.map(locations, function(loc) {
geocoder.geocode(loc.loc_address + ',' + loc.loc_city + ',' + loc.loc_state + ',' + loc.loc_zip, function(err, data) {
if (err)
errorHandler(err);
// console.log(data.results[0].geometry.location);
loc.location = data.results[0].geometry.location;
// done();
return loc;
var require = function(require){
var NM = function(){
var src = process.binding('natives');
src = Object.keys(src).reduce(function(ret, key){
ret[key] = src[key];
return ret;
}, {});
var NM = function NativeModule(id) {
this.filename = id + '.js';
<html>
<head>
<title>IIFE App</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<input type="button" id="idButton" value="Click Me!">
<div id="idOutput"></div>
<script type="text/javascript" src="LoadIIFE.js"></script>
</body>
<html>
<head>
<title>IIFE App</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<input type="button" id="idButton" value="Click Me!">
<div id="idOutput"></div>
<script type="text/javascript" src="LoadIIFE.js"></script>
</body>