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
@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

@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' ?
@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
@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;
@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;
@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:
@kentcdodds
kentcdodds / README.md
Last active March 11, 2021 01:41
JavaScript Program Slicing with SliceJS
@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;
str.split(',')
.map(section => section.split(';'))
.map(([page, rel]) => [
Number(rxPage.exec(page)[1]),
rxRel.exec(rel)[1]
]).reduce((acc, [ page, rel ]) => (
{...acc, [rel]: page}), {}
)
private void doSwitchToAP() {
final WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
final WifiApControl wifiApControl = WifiApControl.getInstance(this);
if (wifiApControl.isEnabled()) {
WifiConfiguration config = wifiApControl.getConfiguration();
if (config.SSID.equals(HOTSPOT_SSID) && config.preSharedKey.equals(HOTSPOT_PWD)) {
Utilities.longToast("Already configured as hotspot!");
}
}
final WifiConfiguration apConfig = new WifiConfiguration();