Skip to content

Instantly share code, notes, and snippets.

@creynders
creynders / grouped-depencies.json
Last active September 8, 2016 12:29
Grouped dependencies
{
"dependencies": {
"base": {
"bluebird": "3.4.0",
"lodash": "4.5.0",
"microtime": "2.1.1",
"uuid": "2.0.1"
},
"production": {
"pm2": "1.1.3"
@creynders
creynders / keystone.xml
Created March 17, 2015 10:26
Keystone code style scheme for Webstorm/PHPStorm
<!-- save to
Mac OS X: ~/Library/Preferences/{WebIdeXX}/codestyles
-->
<code_scheme name="keystone">
<JSCodeStyleSettings>
<option name="INDENT_PACKAGE_CHILDREN" value="1" />
<option name="SPACE_BEFORE_TYPE_COLON" value="true" />
<option name="SPACE_AFTER_TYPE_COLON" value="true" />
<option name="ALIGN_OBJECT_PROPERTIES" value="2" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
@creynders
creynders / Snippets.md
Last active August 29, 2015 13:56
Unnoob Linux
@creynders
creynders / jsbin.kikuf.js
Last active April 29, 2016 20:05
Differences between _.assign, _.merge and _.defaults
console.clear();
var dest = {
foo : {
b1 : "b1 value",
b2 : "b2 value"
},
baz : {
q1 : "q1 value"
},
package robotlegs.bender.extensions.migration{
import org.swiftsuspenders.Injector;
import org.swiftsuspenders.dependencyproviders.DependencyProvider;
import robotlegs.bender.framework.api.IExtension;
import robotlegs.bender.framework.api.IInjector;
public class MapInjectorExtension implements IExtension{
public function extend(context:IContext):void{
const injector : IInjector = context.injector;
const injectorProvider: DependencyProvider = injector.getMapping(IInjector).getProvider();
(function (definition) {
/*
AMD/CommonJS compatibility largely stolen from https://github.com/kriskowal/q/blob/master/q.js
*/
// Turn off strict mode for this function so we can assign to global
/*jshint strict: false, -W117*/
// This file will function properly as a <script> tag, or a module
// using CommonJS and NodeJS or RequireJS module formats. In
// Common/Node/RequireJS, the module exports the API and when
package passByReference
{
/**
* @author creynder
*/
public class PassByReference{
public function PassByReference()
{
var receiver : Receiver = new Receiver();
trace( receiver.counter ); //outputs "1"
package arrayDuplicates
{
import flash.utils.getTimer;
/**
* @author creynder
*/
public class ArrayDuplicates{
public function ArrayDuplicates()
{
package arraySort
{
import mx.utils.ObjectUtil;
public class ArraySort{
public function run() : void{
var i : int;
var n : int = 500;
var arr : Array = [];
for ( i = 0; i<n; i++ ){
arr.push( {
function mymodule_pre_hook(){
register_hook( 'mymodule_form_foo_node_form_alter', 'mymodule_handle_nodetype_form_alter' );
register_hook( 'mymodule_form_baz_node_form_alter', 'mymodule_handle_nodetype_form_alter' );
}
function mymodule_handle_nodetype_form_alter( &$form, &$form_state, $form_id ){
//do what you need
}