Skip to content

Instantly share code, notes, and snippets.

View send2moran's full-sized avatar
🎯
Focusing

Moran Helman send2moran

🎯
Focusing
  • Tel Aviv, Israel
View GitHub Profile
var globals = {
isUndefined: function (o) {
return (o === undefined);
},
isNull: function (o) {
return (o === null);
},
@send2moran
send2moran / gist:d95f91cc4213817d4442
Created July 9, 2014 19:18
JS OOP Layer 4 , super const and sub const
function Person(name){
this.name = name;
}
Person.prototype.say = function(){
console.log("hi");
}
function CTO(){
Person.call(this,"dd")
@send2moran
send2moran / gist:9fcdde24645c6ef1e5b1
Created July 12, 2014 09:33
Generic arguments swapValues function
var arr = [1,2,3,4];
function swapValues(){
return [].slice.call(arguments).reduce(function(a, b) {return a.concat(b);}).reverse();
}
arr = swapValues(arr,5);
console.log(arr)
@send2moran
send2moran / gist:6b1660ec83310e8ec94b
Created August 12, 2014 08:12
We need to make sure that the new operator is always used.
function User(first, last){
if ( !(this instanceof User) )
return new User(first, last);
this.name = first + " " + last;
}
var name = "Resig";
var user = User("John", name);
function qs(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
@send2moran
send2moran / transcodeVideo.js
Last active August 29, 2015 14:15 — forked from Marak/transcodeVideo.js
Hook for transcoding video streams using FFMpeg
var Transcoder = require('stream-transcoder');
module['exports'] = function transcodeVideoStream (hook) {
var readStream = hook.open(hook.params.video);
hook.debug('Opening read stream to video');
hook.res.writeHead(200, {
"Content-Type": "video/mp4"
});
//Channel.js
Sdk.Channel = function (json) {
var __propMap = {
"id": {"prop": "channelId"},
"name": {"prop": "name"},
"watermarkImages": {"prop": "_watermarkImages", "class": Sdk.Image},
"currentProgram": {"prop": "currentProgram", "class": Sdk.Program},
"officialUrl": {"prop": "officialUrl"},
"callSign": {"prop": "callSign"},
"preRollUrl": {"prop": "preRollUrl"},
var userProto = {
login: () => console.log('hello')
};
var User = (json) =>
Object.assign(Object.create(userProto),jsonFromServer,{
});
'use strict';
angular.module('wpclp.cp').directive('cpMultiShareManager', function() {
return {
restrict: 'E',
replace: true,
scope: true,
link: function(scope, el, attr) {
},
/**
* The base implementation of `_.flatten` with added support for restricting
* flattening and specifying the start index.
*
* @private
* @param {Array} array The array to flatten.
* @param {boolean} [isDeep] Specify a deep flatten.
* @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
* @returns {Array} Returns the new flattened array.
*/