Skip to content

Instantly share code, notes, and snippets.

@stonelgh
stonelgh / tellBrowser.js
Last active September 5, 2024 07:39
detect browser type
/**
* Detect browser type and version by parsing browser's UA string.
*
* Based on https://stackoverflow.com/posts/5918791/revisions
* References:
* 1. https://social.msdn.microsoft.com/Forums/vstudio/en-US/ae715fd2-1ddd-46f7-8c26-9aed6b2103f1
* 2. https://en.wikipedia.org/wiki/Trident_(layout_engine)
*
* @return an Array with 3 elements: [type, simulated major-version, actual major-version]
*/
@stonelgh
stonelgh / Create_Iframe_Index_M3U8.bash
Created April 1, 2017 02:53 — forked from svagionitis/Create_Iframe_Index_M3U8.bash
Segment an mp4 file to HLS streaming files
#!/bin/bash
# Create an Iframe index from HLS segmented streams
# $1: Filename to be created
# $2: Location of segmented ts files
# Check how many arguments
if [ $# != 2 ]; then
echo "Usage: $0 [Input filename] [Location of segmented streams]"
exit 1;
fi
@stonelgh
stonelgh / drop_collections.js
Created December 3, 2015 05:56 — forked from timoxley/drop_collections.js
mongoose drop collections helper
var async = require('async')
var _ = require('underscore')
var Helpers = function(mongoose) {
this.mongoose = mongoose || require('mongoose')
this.dropCollections = function(callback) {
var collections = _.keys(mongoose.connection.collections)
async.forEach(collections, function(collectionName, done) {
var collection = mongoose.connection.collections[collectionName]