This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* You can copy and paste this into your browser console and it works as of 1/1/2021 - its not pretty. | |
*/ | |
// replace "user-id" with your actual user id e.g. "123455" & same for auth url | |
const userId = 'my-user-id-goes-here'; | |
const authUrl = 'auth-url-goes-here'; | |
// first gather up all the DOM nodes in the list that have anchors w/ the title id to delete | |
const nodes = document.querySelectorAll('.rowList .title > a'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useReducer } from 'react'; | |
const useUndoReducer = (reducer, initialState) => { | |
const undoState = { | |
past: [], | |
present: initialState, | |
future: [] | |
}; | |
const undoReducer = (state, action) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Steps to reproduce: | |
1. npx create-react-app my-app | |
2. yarn add --dev tailwindcss autoprefixer postcss-cli @fullhuman/postcss-purgecss | |
3. ./node_modules/.bin/tailwind init tailwind.js | |
4. touch tailwind.css | |
5. touch postcss.config.js | |
6. modify start script in package.json: "node scripts/start.js && postcss ./tailwind.css -o src/App.css -w", | |
7. modify build script in package.json: "node scripts/build.js && postcss ./tailwind.css -o src/App.css" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// isolated layer wrapper (for the local variables) | |
(function(_W){ | |
var cache = [], // will store all timeouts IDs | |
_set = _W.setTimeout, // save original reference | |
_clear = _W.clearTimeout // save original reference | |
// Wrap original setTimeout with a function | |
_W.setTimeout = function( CB, duration, arg ){ | |
// also, wrap the callback, so the cache reference will be removed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http = require('http') | |
import https = require('https') | |
import url = require('url') | |
import {AxiosInstance, AxiosInterceptorManager} from 'axios' | |
import {HttpRequestOptions as HttpFollowRequestOptions, http as httpFollow, https as httpsFollow} from 'follow-redirects' | |
import now = require('performance-now') | |
import httpAdapter = require('axios/lib/adapters/http') | |
import InterceptorManager = require('axios/lib/core/InterceptorManager') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The polling function | |
function poll(fn, timeout, interval) { | |
var endTime = Number(new Date()) + (timeout || 2000); | |
interval = interval || 100; | |
var checkCondition = function(resolve, reject) { | |
var ajax = fn(); | |
// dive into the ajax promise | |
ajax.then( function(response){ | |
// If the condition is met, we're done! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
var webpack = require('webpack'); | |
module.exports = { | |
entry: [ | |
'react-hot-loader/patch', | |
'webpack-dev-server/client?http://localhost:3000/', | |
'webpack/hot/only-dev-server', | |
path.resolve(__dirname, 'app/index') | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES6 | |
// Count duplicate items | |
const names = ['Mike', 'Matt', 'Nancy', 'Adam', 'Jenny', 'Nancy', 'Carl'] | |
const count = names => | |
names.reduce((a, b) => | |
Object.assign(a, {[b]: (a[b] || 0) + 1}), {}) | |
const duplicates = dict => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To run this script you need to give execute permission. | |
# $chmod +x restart_bluetooth.sh; | |
# If you want only to restart: | |
# $ ./restart_bluetooth.sh; | |
# If you want to turn bluetooth on; | |
# $ ./restart_bluetooth.sh 1; | |
# If you want to turn bluetooth off; | |
# $ ./restart_bluetooth.sh 0; |
NewerOlder