Skip to content

Instantly share code, notes, and snippets.

@mamoo
mamoo / Agile_at_CREA_2017.md
Last active April 3, 2017 20:05
Additional references for the course on Agile methodologies and Practices - 2017
@mamoo
mamoo / openapi_specification_fka_swagger_specification_tutorial.md OpenAPI Specification (fka Swagger Specification) tutorial files from [API Handyman blog](http://apihandyman.io)
@mamoo
mamoo / initializearray.js
Last active December 28, 2015 17:48
Array initialization (ECMAScript 5)
//Initialize an array of x items with undefined values.
//cfr. http://www.2ality.com/2013/11/initializing-arrays.html
var x = 5;
Array.apply(null, Array(x));
@mamoo
mamoo / boxstarter_dev_setup
Last active August 29, 2015 14:16
BoxStarter Dev Win8.1 Machine Setup
Update-ExecutionPolicy Unrestricted
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
cinst Firefox
cinst GoogleChrome
cinst Opera
cinst evernote
cinst skitch
@mamoo
mamoo / conversion_to_int_using_bitwise_or.js
Last active December 25, 2015 12:13
Javascript conversion to Integer using bitwise OR with zero
/* Bitwise operators convert their operands to integers and give integer results.
* This means that a bitwise OR with zero, an otherwise useless operation, converts a value to an integer.
* Credits: http://en.wikipedia.org/wiki/Asm.js#Examples
*/
var notANumber = "5";
var aNumber = notANumber|0;
console.log(typeof aNumber);
@mamoo
mamoo / gist:33650f7ade2dd588c038
Created October 7, 2014 06:39
Find duplicate column value in DB
SELECT col_1, COUNT(*) FROM table GROUP BY col_1 HAVING COUNT(*) > 1;
@mamoo
mamoo / stringpad
Created December 16, 2013 12:45
Simple string padding method using Array.
function pad(string, length, padstring){
if (!string || !length || !padstring)
throw new Error('all parameters must be defined');
var outputstr = '' + string,
diff = length - outputstr.length;
if (diff < 1) return string;
var arr = new Array(diff);
arr.push(outputstr);
@mamoo
mamoo / python_http_server_start.bat
Last active December 25, 2015 12:15
Python simple HTTP server
python -m SimpleHTTPServer
python -m http.server
@mamoo
mamoo / requirejs.cache.bust.js
Created September 10, 2012 20:22
require js test (bust browser caching by appending a dummy url param).
require.config({
baseUrl: "/js/",
urlArgs: 'cb=' + Math.random(), // <<< That's it.
paths: {...
@mamoo
mamoo / underscorejs.template.js
Created September 6, 2012 07:15
Underscore.js template interpolation and evaluation change (replace <% %> with <@ @> to avoid conflicts with asp.net)
_.templateSettings = {
interpolate: /\<\@\=(.+?)\@\>/gim,
evaluate: /\<\@(.+?)\@\>/gim
};