Skip to content

Instantly share code, notes, and snippets.

View marcelaraujo's full-sized avatar

Marcel Araujo marcelaraujo

  • Lisbon/PT
View GitHub Profile
@mikaelbr
mikaelbr / destructuring.js
Last active February 11, 2026 00:57
Complete collection of JavaScript 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];
@listochkin
listochkin / node-command-line-options.txt
Created April 17, 2014 11:00
Node V8 GC-related options
--log_gc (Log heap samples on garbage collection for the hp2ps tool.)
type: bool default: false
--expose_gc (expose gc extension)
type: bool default: false
--max_new_space_size (max size of the new generation (in kBytes))
type: int default: 0
--max_old_space_size (max size of the old generation (in Mbytes))
type: int default: 0
--max_executable_size (max size of executable memory (in Mbytes))
type: int default: 0
#!/bin/bash
#
# Bash script to setup headless Selenium (uses Xvfb and Chrome)
# (Tested on Ubuntu 12.04) trying on ubuntu server 14.04
# Add Google Chrome's repo to sources.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
# Install Google's public key used for signing packages (e.g. Chrome)
# (Source: http://www.google.com/linuxrepositories/)
@guptag
guptag / React Class Template
Last active November 17, 2016 12:02
ReactJS
// React Class template with inlined documentation from
// http://facebook.github.io/react/docs/component-specs.html
var component = React.createClass({
/***** Core Methods *****/
render: function () {
// Returns ReactComponent
@pankajp
pankajp / serve_http.py
Last active February 19, 2026 10:41
Simple Python HTTP Server with multi-threading and partial-content support
#! /usr/bin/env python
# Standard library imports.
from SocketServer import ThreadingMixIn
import BaseHTTPServer
import SimpleHTTPServer
import sys
import json
import os
from os.path import (join, exists, dirname, abspath, isabs, sep, walk, splitext,
@marcelaraujo
marcelaraujo / test.html
Last active August 29, 2015 14:01
xmlrequest api bug at Chrome
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
var httpRequest;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
#!/usr/bin/env python
# Clone or update all a user's gists
# curl -ks https://gist.githubusercontent.com/fedir/5466075/raw/gist-backup.py | USER=fedir python
# USER=fedir python gist-backup.py
import json
import urllib
from subprocess import call
from urllib import urlopen
import os
@therebelrobot
therebelrobot / Request.node.js
Created June 23, 2014 23:55
Node.js function for consuming API
var http = require('http');
var options = {
hostname: 'api.github.com',
path: '/api/endpoint',
headers: {
'User-Agent': 'UserAgentHere',
'Accept': 'application/json'
}
};
var request = http.request(options, function(response) {
@zxy1256
zxy1256 / Tmux.md
Last active January 6, 2024 04:18
Tmux

tmux shortcuts & cheatsheet

Sessions

start new:

tmux
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();