Skip to content

Instantly share code, notes, and snippets.

View vinicius73's full-sized avatar
🤓
"Those who cannot acknowledge themselves, will eventually fail."

Vinicius Reis vinicius73

🤓
"Those who cannot acknowledge themselves, will eventually fail."
View GitHub Profile
@wilcorrea
wilcorrea / $_GET.js
Last active November 4, 2016 19:16
<script>
function $_GET(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
const regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
const results = regex.exec(url);
if (!results) {
return null;
@kentcdodds
kentcdodds / README.md
Last active March 11, 2021 01:41
JavaScript Program Slicing with SliceJS
@ericelliott
ericelliott / .travis.yml
Created October 29, 2016 20:46
Using Yarn on Travis-CI
language: node_js
node_js:
- "6"
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
@vinicius73
vinicius73 / async-examples.js
Created October 21, 2016 09:58 — forked from developit/async-examples.js
Async Array utilities in async/await. Now available as an npm package: https://github.com/developit/asyncro
/** Async version of Array.prototype.reduce()
* await reduce(['/foo', '/bar', '/baz'], async (acc, v) => {
* acc[v] = await (await fetch(v)).json();
* return acc;
* }, {});
*/
export async function reduce(arr, fn, val, pure) {
for (let i=0; i<arr.length; i++) {
let v = await fn(val, arr[i], i, arr);
if (pure!==false) val = v;
@developit
developit / async-examples.js
Last active February 19, 2020 00:43
Async Array utilities in async/await. Now available as an npm package: https://github.com/developit/asyncro
/** Async version of Array.prototype.reduce()
* await reduce(['/foo', '/bar', '/baz'], async (acc, v) => {
* acc[v] = await (await fetch(v)).json();
* return acc;
* }, {});
*/
export async function reduce(arr, fn, val, pure) {
for (let i=0; i<arr.length; i++) {
let v = await fn(val, arr[i], i, arr);
if (pure!==false) val = v;
@thursby
thursby / gist:8ac6cb96c84b6d20a3fb1bf3048d46ed
Last active March 25, 2017 16:21
Set the sensitivity for the Logitech M570 in Linux. For whatever reason most controls won't let you set sensitivity less than 1. My trackball likes 0.4. The way this is set is weird because the IDs seem to change whenever the USB is connected and disconnected. I wrote this oneliner to find 'em and change it.
xinput list --short | grep Logitech | awk '{print $5}' | cut -f2 -d"=" | xargs -I id xinput set-prop id "Device Accel Constant Deceleration" 0.4
@tansongyang
tansongyang / ramda-evolve-in-lodash-fp.js
Last active July 10, 2018 07:53
An implementation of Ramda's `evolve` function in lodash.
// http://stackoverflow.com/questions/38090023/whats-the-lodash-fp-equivalent-of-ramdas-evolve-function/38425764#38425764
const mapValuesWithKey = _.mapValues.convert({cap: false});
function evolve(transformations) {
return item =>
mapValuesWithKey((value, key) => {
const transformation = _.getOr(_.identity)(key)(transformations);
const type = typeof transformation;
return type === 'function' ?
@mlynch
mlynch / cordova-plugin-guide.md
Last active February 3, 2023 00:21
Cordova Plugin Developer Guide

Cordova Plugin Development Guide (iOS and Android)

Version: 0.0.1 updated 7/1/2016

Cordova Plugins are the magic that enable our mobile web app content to access the full power of Native SDKs underneath, but through clean JavaScript APIs that work the same across all platforms we target.

Building Cordova plugins is scary for many Cordova and Ionic developers, but it doesn't have to be. This simple guide walks through the what, when, why, and how of Cordova plugin development for iOS and Android.

Introduction

@lukzgois
lukzgois / SimpleTransformer.php
Created May 12, 2016 14:30
Simple transformer for Laravel
<?php
namespace App\Domain\Transformer;
use Illuminate\Contracts\Pagination\LengthAwarePaginator as PaginatorContract;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Collection;
use MongoDB\Model\BSONArray;
@impeto
impeto / Array.chunk.js
Created January 31, 2016 16:25
Adds method `chunk` to the array class similar to Eloquent Collection's chunk method
(function() {
Array.prototype.chunk = function (chunkSize) {
var n = this.length;
if (chunkSize >= n) {
return [this];
}
if (n == 0) {
return [];