Skip to content

Instantly share code, notes, and snippets.

<?php
# This file was automatically generated by the MediaWiki 1.38.0-alpha
# installer. If you make manual changes, please keep track in case you
# need to recreate them later.
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
#
# Further documentation for configuration settings may be found at:
{
"wgAPICacheHelpTimeout": 3600,
"wgAPIFormatModules": [],
"wgAPIListModules": {
"growthtasks": {
"class": "GrowthExperiments\\Api\\ApiQueryGrowthTasks",
"services": [
"GrowthExperimentsTaskSuggesterFactory",
"GrowthExperimentsNewcomerTasksConfigurationLoader",
"GrowthExperimentsLinkRecommendationFilter",
@sgimeno
sgimeno / fibonacci.js
Last active April 26, 2018 11:20
Rec vs Loop Fibonacci for teaching purposes
function FibonacciSeqRec(n) {
const fib = (seq) => {
if (seq.length === n) return seq
if (seq.length < 2) seq.push(1)
else seq.push(seq[seq.length - 2] + seq[seq.length - 1])
return fib(seq)
}
return fib([])
}
@sgimeno
sgimeno / flatten.js
Created March 27, 2018 12:18
Flatten Arrays
const flatten = (arr) => {
const res = []
const flattenRec = (elem) => {
if (Array.isArray(elem) && elem.length > 0) {
elem.forEach(e => flattenRec(e))
} else {
res.push(elem)
}
}
@sgimeno
sgimeno / node-readline-question.js
Created April 30, 2016 16:27
Prompt a question with Node
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('Enter the problem input: ', (input) => {
console.log(`Input: ${input}`);
@sgimeno
sgimeno / cordova-upload-picture.js
Created July 8, 2015 15:44
Snippet to upload pictures using cordova plugins
//You will need the following cordov plugins
// + https://github.com/apache/cordova-plugin-file-transfer
// + https://github.com/apache/cordova-plugin-file
angular.module('someModule', [])
.service('cordovaService', function($window, $document, $q, $timeout) {
// Source https://github.com/mgcrea/angular-cordova/blob/master/src/angular-cordova.js
var self = this;
this.cordova = $window.cordova || {};
var wsock = require('websocket-stream');
var ws = wsock('ws://' + location.host);
var split = require('split2');
var through = require('through2');
var h = require('virtual-dom/h');
var state = { images: [] };
var createImage = require('./image.js');
var main = require('main-loop');
@sgimeno
sgimeno / compileEJS.js
Last active August 29, 2015 14:21
Compile EJS in an ExpressJS route handler
function (req, res){
var ejs = require('ejs');
var fs = require('fs');
var async = require('async');
async.map([__dirname + '/template.ejs'], fs.readFile, function(err, files) {
if(err) {
throw err;
}
_.merge = wrapFunct(_.merge);
_.union = wrapFunct(_.union);
_.merge(AJAX.get('foo'), [ 'en' ], AJAX.get('bar'));
@sgimeno
sgimeno / git-completition.sh
Created September 30, 2014 14:42
git completition script
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#