Skip to content

Instantly share code, notes, and snippets.

View zinzinday's full-sized avatar
🏠
Working from home

Nghia Nguyen zinzinday

🏠
Working from home
View GitHub Profile
import {Directive, forwardRef, Provider} from "angular2/core";
import {NG_VALUE_ACCESSOR, ControlValueAccessor} from "angular2/common";
import {CONST_EXPR} from "angular2/src/facade/lang";
const FILE_VALUE_ACCESSOR = CONST_EXPR(
new Provider(NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => FileControlValueAccessor), multi: true})
);
/**
* The accessor for listening to changes that is used by the
@oshybystyi
oshybystyi / TestModel.js
Last active March 31, 2018 11:08
Checking how to know old attribute values in mongoose middleware
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var testModelSchema = new Schema({
name: String,
ready: {type: Boolean, default: false}
});
testModelSchema.pre('init', function(done) {
console.log('------------------');
@svagionitis
svagionitis / Create_Iframe_Index_M3U8.bash
Last active June 21, 2024 22:54
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
@hagino3000
hagino3000 / client.js
Created December 8, 2011 18:42
WebSocket with binary data
var socket = null;
function bootstrap() {
// 適当な図形を描画
var c = document.getElementById('mycanvas');
var ctx = c.getContext('2d');
ctx.globalalpha = 0.3;
for(var i=0; i<1000; i++) {
ctx.beginPath();