Skip to content

Instantly share code, notes, and snippets.

@lcustodio
lcustodio / showAlert.js
Created August 31, 2015 10:34
In order to find where any alert box comes from.
//Open the debugger console, type the following:
var _alert = window.alert;
window.alert = function () { debugger; _alert.apply(this, arguments); }
//Do not reload the page!
//When the alert will be called, it breaks in the debugger and you have access to the call stack.
//Credits to @ArnaudBuchholz
@lcustodio
lcustodio / hierarchy.js
Created September 4, 2015 20:06
Simple explanation between classes, prototypes and properties in javascript
//Class
function MyClass() {
this.ownMember = 123;
}
//Prototype declaration
MyClass.prototype = {
prototypeMember: 456
};
@lcustodio
lcustodio / string.prototype.js
Created October 15, 2015 13:08
String prototypes
(function () {
'use strict';
var proto = String.prototype;
if (undefined === proto.startsWith) {
/**
* Returns true if the string starts with the given one
*
* @param {String} str
@lcustodio
lcustodio / output
Last active July 15, 2016 10:42
easy-webpack/config-less
***
less config:
...
require('@easy-webpack/config-less')
({ filename: 'styles.css', allChunks: false, sourceMap: false }),
...
***
@lcustodio
lcustodio / measures.js
Created September 7, 2016 20:50
Node processing time measurement tools
const arrayOfObjects = [
{name: 'A', level: 5},
{name: 'B', level: 10},
{name: 'C', level: 15},
{name: 'D', level: 20},
{name: 'E', level: 25},
{name: '-', level: 0}
];
let cloneArrayA = arrayOfObjects.slice();
@lcustodio
lcustodio / destructuring.js
Created July 10, 2017 12:06 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@lcustodio
lcustodio / container.js
Created September 16, 2017 12:24
Component wrapper to centralize blog-like content
import React from "react"
export default ({ children }) =>
<div style={{ margin: "3rem auto", maxWidth: 600 }}>
{children}
</div>
@lcustodio
lcustodio / api-discussion.md
Last active October 25, 2017 12:50
Api discussion

Option 1

POST

{
  "command": "SET_PROCESS_THRESHOLD",
  "parameters": {
  	"processName": "New Vacation Request",
    "newTargetDurationInMillis": "NULL | 0"
 }
@lcustodio
lcustodio / inspect-node-in-chrome.sh
Created November 27, 2017 10:36
Debug Node into Chrome
#NiM - Node.js V8 --inspector Manager (NiM)
#https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj?hl=en
node --inspect-brk 01-hello.js
@lcustodio
lcustodio / GIF-Screencast-OSX.md
Created December 12, 2017 10:22 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: