Skip to content

Instantly share code, notes, and snippets.

View MCheli's full-sized avatar

Mark Cheli MCheli

View GitHub Profile
// Get a reference to the player
var myPlayer = videojs("S1LnMbpBz"),
options = {};
// +++ Define the playback rate options +++
options = { playbackRates: [0.5, 0.75, 1, 1.25, 1.5, 2] };
// +++ Turn off the default source order +++
if (Array.isArray(options.playbackRates)) {
// Set sourceOrder to false - this means old browsers that support HLS in Flash but not HTML5/MSE will use MP4.
@MCheli
MCheli / 0_reuse_code.js
Created September 19, 2017 23:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@MCheli
MCheli / gist:d0e90e96b8afccfa55613f2e6b6274c7
Last active September 25, 2017 06:13 — forked from madis/gist:4650014
Testing CORS OPTIONS request with curl
curl \
--verbose \
--request OPTIONS \
https://academic-dev1.cloud.thingworx.com/Thingworx/Things/testingCORS/Properties/test \
--header 'Origin: http://localhost:3000' \
--header 'appKey: 29506e99-bca6-4522-b60e-55bd891716f7' \
--header 'Access-Control-Request-Headers: Origin, Accept, Content-Type' \
--header 'Access-Control-Request-Method: GET'
@MCheli
MCheli / style.css
Created October 28, 2016 12:37
Remove default styling from <a> tag (for links)
a, a:link, a:visited, a:focus, a:active {
color: #ffffff;
text-decoration: none;
}
@MCheli
MCheli / app.js
Created August 19, 2016 14:46
Looping through nested objects
var propertyList = JSON.parse(newProject.dataConfig);
//Loop through the list types of data
for(key in propertyList) {
//Loop through the properties in each type of data
for(prop in propertyList[key]) {
result = propertyList[key][prop].propType;
}
}
@MCheli
MCheli / services.js
Created July 28, 2016 00:06
Using $localstorage
.factory('$localStorage', ['$window', function($window) {
return {
store: function(key, value) {
$window.localStorage[key] = value;
},
get: function(key, defaultValue) {
return $window.localStorage[key] || defaultValue;
},
storeObject: function(key, value) {
$window.localStorage[key] = JSON.stringify(value);
@MCheli
MCheli / app.js
Created July 27, 2016 23:40
Ionic Global Loading Bar
.run(function($ionicPlatform, $rootScope, $ionicLoading) {
$ionicPlatform.ready(function () {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
@MCheli
MCheli / server.js
Created June 27, 2016 21:02
Basic Authentication Express + Node Server
var express = require('express');
var morgan = require('morgan');
var hostname = 'localhost';
var port = 3000;
var app = express();
app.use(morgan('dev'));
@MCheli
MCheli / dishRouter.js
Created June 27, 2016 01:16
Express Router REST API w/ Mongoose CRUD Operations Example
var express = require('express');
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
var Dishes = require('../models/dishes');
var dishRouter = express.Router();
dishRouter.use(bodyParser.json());
dishRouter.route('/')
@MCheli
MCheli / operations.js
Created June 19, 2016 21:09
Simple Node and MongoDB Interaction
var assert = require('assert');
exports.insertDocument = function(db, document, collection, callback) {
// Get the documents collection
var coll = db.collection(collection);
// Insert some documents
coll.insert(document, function(err, result) {
assert.equal(err, null);
console.log("Inserted " + result.result.n + " documents into the document collection "
+ collection);