Skip to content

Instantly share code, notes, and snippets.

View imbcmdth's full-sized avatar

Jon-Carlos Rivera imbcmdth

View GitHub Profile
@imbcmdth
imbcmdth / masala.js
Last active August 29, 2015 14:16
Masala Example
/* SOME_MODULE.js */
var masala = require('masala');
// The default arguments have a lot of unbound parameters (something like 12)
// They specify a myriad of arguments from invocation-specific parameters
// to general options that should be mostly shared between all invocations
var defaultArguments = { ... };
function genericFunction (options, callback) { ... }
// Dash live profile:
{
"duration": 60200,
"poster_sources": [
{
"src": "http://brightcove.vo.lowlight.local/ll/media/file/3303963094001/3303963094001_30328785791202_30328762662001-vs.jpg?pubId=3303963094001"
},
{
"src": "https://sadmin.brightcove.com/ll/media/file/3303963094001/3303963094001_30328785791202_30328762662001-vs.jpg?pubId=3303963094001"
@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"
}
}
videojs.players.vjs_video_3.player.src({
src: 'http://some.com/manifest.mpd',
type: 'application/dash+xml'
});
@imbcmdth
imbcmdth / target.js
Created March 9, 2012 00:03
A Better "AppDev University - Full Stack Web Development"
var asymHumanoidBodyParts = [["head", 3],
["left-eye", 1],
["left-ear", 1],
["mouth", 1],
["nose", 1],
["neck", 2],
["left-shoulder", 3],
["left-upper-arm", 3],
["chest", 10],
["back", 10],
@imbcmdth
imbcmdth / gist:2958401
Created June 20, 2012 06:14
Example IIFE
(function(global) { // global is == to window
"use strict"; // Tells JS engine to warn you about silly things you've done
var myVariable = 10;
function internalFunction(val) {
return myVariable * val;
}
global.externalFunction = function(num){
<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>
var parent = {a:2, b:33};
var ChildMaker = function(){};
ChildMaker.prototype = parent;
var child = new ChildMaker();
parent.c = 2;
child.c; // 2
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';