Skip to content

Instantly share code, notes, and snippets.

View feload's full-sized avatar

Felipe feload

  • México
View GitHub Profile
@feload
feload / toTop.js
Created August 28, 2017 18:56
toTop.js Send certain objects to the top of the stack.
/**
* toTop()
* Send certain objects to top of the stack.
*/
const toTop = (col, what, where) => {
const ttop = [];
const tail = [];
col.forEach((i) => {
@feload
feload / headless.md
Created October 3, 2017 15:57 — forked from addyosmani/headless.md
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@feload
feload / p.js
Last active October 30, 2017 16:19
Formats a string into a paragraph string.
export const p = (str = "") => {
if(!str || str.length < 1) return "";
str = str.replace('_', ' ');
return str.split(" ").map((word, index) => {
if(index == 0) {
const wordChunks = word.toLocaleLowerCase().split('');
wordChunks[0] = wordChunks[0].toUpperCase();
return wordChunks.join('');
}else{
return word.toLowerCase();
@feload
feload / readdir_recurs_sync.js
Created November 23, 2017 20:41 — forked from dlabey/readdir_recurs_sync.js
NodeJS ReaddirSync Recursive
function readdirRecursSync(dir, filelist) {
filelist = filelist || [];
var files = fs.readdirSync(dir);
files.forEach(function (file) {
file = path.join(dir, file);
if (fs.statSync(file).isDirectory()) {
filelist = readdirRecursSync(file, filelist);
@feload
feload / install_elasticsearch_osx.md
Created January 25, 2018 18:27 — forked from djonsson/install_elasticsearch_osx.md
OS X installation instructions for Elasticsearch + Kibana + Marvel

What is this?

Following this guide will set up a local Elasticsearch with Kibana and Marvel using Homebrew and Homebrew Cask

Prerequisites

If you already have Java installed on your system, skip steps Install Cask and Install Java

If you already have Java and Homebrew installed on your system, skip steps Prerequisites, start at Install Elasticsearch and Kibana after running $ brew update

Install Homebrew

  • $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@feload
feload / github.md
Created January 31, 2018 22:41 — forked from ajmalafif/github.md
git - clone recursive depth for submodules repos

git clone --recursive --origin wp-boiler --depth 1 [email protected]:pricelessmisc/wp-boiler.git

@feload
feload / leftPad.js
Created February 27, 2018 18:57
String left pad.
export const leftPad = (str, howMany, char = '0') => {
if(str.length >= howMany) return str;
const space = Array(howMany).fill(char);
const aStr = str.split('');
const merge = space.concat(aStr);
merge.splice(0, aStr.length);
return merge.join('');
}
@feload
feload / permutator.cs
Last active March 10, 2018 12:54
CSharp Permutator
using System;
class MainClass {
public static void Main (string[] args) {
// Credits https://www.codeproject.com/Articles/37215/Permutations-in-C-Using-Recursion
Console.Write("Input String>");
string inputLine = Console.ReadLine();
@feload
feload / browser_detect.js
Created July 6, 2018 13:05 — forked from 2107/browser_detect.js
JavaScript: Detect Browser
// browser detect
var BrowserDetect = {
init: function() {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function(data) {
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
@feload
feload / dislike.js
Created July 16, 2018 14:12
Auto-dislike for facebook.
const dislike = (el) => {
return new Promise((res, rej) => {
el.click();
setTimeout(() => {
document.querySelector('a.itemAnchor').click();
setTimeout(() => {
res();
}, 1000);
}, 2000);
});