Skip to content

Instantly share code, notes, and snippets.

View nacapulque's full-sized avatar

Raúl Salinas nacapulque

View GitHub Profile
@mikowl
mikowl / oneliners.js
Last active June 29, 2024 17:39
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@mattdesl
mattdesl / about.md
Created February 14, 2019 16:03
A Browser and Node.js compatible canvas-sketch script for generative and parametric 3D geometry.

Generative Geometry in Browser + Node.js

Here is a script that can be run with canvas-sketch to generate OBJ files from a parametric/algorithmic 3D ThreeJS geometry.

Hitting "Cmd + S" from the canvas-sketch tool will export a PNG and OBJ file of the scene.

If the same script is run from Node, it will simply render the OBJ to stdout, or write to the filename argument if given.

@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active March 12, 2024 22:46
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
Firefox Developer Edition
Google Chrome
Xcode
Fabric
Android Studio
Genymotion
Expo
Visual Studio Code
Evernote
@ljharb
ljharb / array_iteration_thoughts.md
Last active May 22, 2024 09:22
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@cvan
cvan / google-sheets-sync-to-firebase.js
Last active March 23, 2020 18:05
Google Spreadsheets script for syncing to Firebase
function syncToFirebase () {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var numCols = rows.getNumColumns();
var values = rows.getValues();
var output = [];
var sheetName = sheet.getName();
@wellington1993
wellington1993 / A-Rails-Angular-install-node.sh
Last active April 4, 2018 08:37
Ubuntu instructions to install Node.js(+ npm) + AngularJS + YEOMAN + generator-angular + rbenv + Ruby + Rails-api - App Example: https://github.com/wellington1993/astronauta-test1-rails-angular
# Before this please install zsh and oh-my-zsh
apt-get install curl
#curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs vim htop git gitg
sudo add-apt-repository ppa:chris-lea/node.js
@oalami
oalami / earthquakes.js
Last active March 12, 2021 13:27
Global Earthquakes in Realtime using Firebase Open Data Sets
const CONTINENTS = ["europe", "asia", "africa", "north_america", "south_america", "antartica", "oceanic"];
var map;
var previousInfowindow;
var ref = new Firebase("https://publicdata-earthquakes.firebaseio.com/by_continent/");
function mapQuake(snapshot) {
var quake = snapshot.val();
var myLatlng = new google.maps.LatLng(quake.location.lat,quake.location.lng);
map.setCenter(myLatlng);
@rxaviers
rxaviers / gist:7360908
Last active July 1, 2024 07:56
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@leemour
leemour / Zsh & theme
Last active April 12, 2023 08:53
Zsh installation and Agnoster theme settings
# Railscast
http://railscasts.com/episodes/308-oh-my-zsh
# Install Zsh
sudo apt-get update && sudo apt-get install zsh
# Install Oh-my-zsh
wget –no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O – | sh
# Make ZSH default shell