Skip to content

Instantly share code, notes, and snippets.

View coreyphillips's full-sized avatar

Corey coreyphillips

View GitHub Profile
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@bgrins
bgrins / detectDataURL.js
Last active December 18, 2023 18:57
Detect if a string is a data URL. Doesn't try to parse it or determine validity, just a quick check if a string appears to be a data URL. See http://jsfiddle.net/bgrins/aZWTB/ for a demo.
// Detecting data URLs
// data URI - MDN https://developer.mozilla.org/en-US/docs/data_URIs
// The "data" URL scheme: http://tools.ietf.org/html/rfc2397
// Valid URL Characters: http://tools.ietf.org/html/rfc2396#section2
function isDataURL(s) {
return !!s.match(isDataURL.regex);
}
isDataURL.regex = /^\s*data:([a-z]+\/[a-z]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i;
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active September 15, 2024 20:33
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@samma835
samma835 / xcarchive2ipa
Created December 23, 2015 07:21
How to convert .xcarchive to .ipa
xcodebuild -exportArchive -exportFormat ipa -archivePath {PATH}/MyApp.xcarchive -exportPath ~/Desktop/MyApp.ipa
@pirate
pirate / parseURLParameters.js
Last active December 15, 2023 07:17
Parse URL query parameters in ES6
function getUrlParams(search) {
const hashes = search.slice(search.indexOf('?') + 1).split('&')
const params = {}
hashes.map(hash => {
const [key, val] = hash.split('=')
params[key] = decodeURIComponent(val)
})
return params
}
@simonkberg
simonkberg / reactiflux-qa.md
Last active April 4, 2018 20:25
Q&A with Sophie Alpert (@sophiebits) on Reactiflux 2016-06-09

Q: Are there plans to support a web worker based rendered in React Core ? Angular2 has support for it in core - axemclion
A: right now we're not considering web workers in depth because it's difficult to carve off pieces that can be parallelized independently -- simply moving React to a separate thread while executing DOM operations on the main thread would free up the main thread but likely wouldn't improve responsiveness overall. so instead we're looking more at how we can do concurrent work on the main thread and cancel in-progress updates if new high-priority input arrives
we might experiment a little more with threads/workers on React Native, but that would likely be more along the lines of running parts of Relay in a separate thread since it's still hard to split up the component tree

Q: did you ever think you’d be learning about fibers and coroutines to implement a JavaScript UI library? 😃 - iamdustan
A: can't say I ever considered it, but I suppose I didn't expect that I wou

@luyx2412
luyx2412 / google-drive.js
Last active July 14, 2021 13:03
React native login google, and google drive. Save storage and get again data when uninstall app.
/**
* Google Drive
* created by [email protected]
*/
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,

Setup Bitcoin.conf

bitcoin.conf flags for LND integration

rpcpassword= // make a strong password
rpcuser=bitcoinrpc
server=1
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28332
@miguelmota
miguelmota / electrum_get_balance.js
Created June 5, 2018 22:00
Electrum client get balance in Node.js
const ElectrumClient = require('electrum-client')
const peers = require('electrum-host-parse').getDefaultPeers('BitcoinSegwit').filter(v => v.ssl)
const getRandomPeer = () => peers[peers.length * Math.random() | 0]
let mainClient = false
const main = async () => {
const peer = getRandomPeer()
console.log('begin connection:', JSON.stringify(peer))
mainClient = new ElectrumClient(peer.ssl, peer.host, 'ssl')
@junderw
junderw / createNewRegtestServer.sh
Last active November 19, 2018 09:33
Simple setup for Ubuntu 18.04 server
### new ubuntu 18.04 server
### Be sure to run
# sudo apt-get update && sudo apt-get -y upgrade && sudo reboot
### For security updates
### Then run this script with passwordless sudo account ubuntu (default for ubuntu AWS EC2):
# CERTDOMAIN=something.yourdomain.com [email protected] ./thisScript.sh
# Install Bitcoin 0.17.0 etc.
sudo add-apt-repository -y ppa:bitcoin/bitcoin &>/dev/null
sudo apt-get update &>/dev/null