Skip to content

Instantly share code, notes, and snippets.

@cef62
cef62 / JSONConverter.as
Created July 4, 2012 12:43 — forked from sinnus/Converter.as
An utility class to permit deserialization from JSON strings to As3 Typed Objects. To original implementation by Sinnus, I've added possibilities to define mapping for properties typed as Interfaces. The Mapping can be supplied via registerClassAlias() me
package
{
import flash.net.getClassByAlias;
import flash.utils.describeType;
import flash.utils.getDefinitionByName;
import flash.utils.getQualifiedClassName;
import mx.utils.ObjectUtil;
public class JSONConverter
@cef62
cef62 / MainController.js
Last active August 29, 2015 14:17 — forked from pswai/ng-strap-modal-decorator.js
Decorate ng-strap modal component with an .open() method to support dynamic controller, resolved properties. A promise is returned from open(), resolving when user confirm the modal and rejecting when user cancel the modal.
(function () {
'use strict';
angular.module('app.views', [])
.controller('MainController', MainController);
function MainController($modal) {
// ---------------------------------
// Open Modal
@cef62
cef62 / readme.md
Last active August 29, 2015 14:28 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@cef62
cef62 / gist:97323b13bf4a1fdbe650
Created November 7, 2015 20:12 — forked from whisher/gist:d6e3db7c11d632720133
Hapijs brute force mitigation
'use strict';
/**
* Module dependencies.
*/
const Hoek = require('hoek');
const Limiter = require('ratelimiter');
const RedisClient = require('../utils/redis');
const ReplyUtil = require('../utils/reply');
@cef62
cef62 / server.js
Last active November 17, 2015 17:22 — forked from maman/server.js
HTML5 API support con webpack-dev-middleware and index.html dynamically generated
/*eslint-disable */
var path = require('path');
var express = require('express');
var webpack = require('webpack');
var config = require(path.join(__dirname, 'webpack.config'));
var app = this.app = new express();
var compiler = webpack(config);
var devMiddleware = require('webpack-dev-middleware')(compiler, {
noInfo: true,
@cef62
cef62 / Enhance.js
Created November 27, 2015 17:55 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@cef62
cef62 / destructuring.js
Created December 3, 2015 13:42 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring.
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => {
return [1, 2, 3];
@cef62
cef62 / App.js
Last active January 3, 2016 17:16 — forked from fabiobiondi/App.js
EaselJS and HTML5 Canvas - ES6 Custom Display Objects (based on ES5 version: http://www.createjs.com/tutorials/Inheritance/)
import CircleButton from './CircleButton';
// Init stage
const stage = new createjs.Stage("demo");
// Button black
const btn = new CircleButton('Hi');
btn.x = 50; btn.y = 50;
stage.addChild(btn);
@cef62
cef62 / setup-modernie-vagrant-boxes.md
Created February 2, 2016 21:49 — forked from andrealbinop/setup-modernie-vagrant-boxes.md
Setup modern.ie vagrant boxes

Setup modern.ie vagrant boxes

Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.

However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.

Pre-requisites

@cef62
cef62 / gist:5ca90fe87f38f2f5f801
Created February 10, 2016 23:14 — forked from danieleds/gist:326903084a196055a7c3
CodeMirror: indent with tab or spaces
editor.addKeyMap({
"Tab": function (cm) {
if (cm.somethingSelected()) {
var sel = editor.getSelection("\n");
// Indent only if there are multiple lines selected, or if the selection spans a full line
if (sel.length > 0 && (sel.indexOf("\n") > -1 || sel.length === cm.getLine(cm.getCursor().line).length)) {
cm.indentSelection("add");
return;
}
}