Skip to content

Instantly share code, notes, and snippets.

🤔
Not your keys, not your coins.

Steven Black StevenBlack

🤔
Not your keys, not your coins.
View GitHub Profile
@slorber
slorber / react-navigation-tree.jsx
Last active May 31, 2020
react-navigation-tree.jsx
View react-navigation-tree.jsx
const App = createAppContainer(
createStack({
LoggedSwitch: createSwitch({
// When user is authenticated
LoggedIn: createStack({
// The logged in root is generally a tab or drawer navigator
LoggedInRoot: createTabsOrDrawer({
@shcallaway
shcallaway / README.md
Created Feb 22, 2019
Bookmarklet for getting past digital publication paywalls
View README.md

When creating a new browser bookmark, paste the following code snippet into the "Location" field:

javascript:(function(){window.location="https://outline.com/"+window.location;})();

Now visit an article that has a paywall, and click your bookmarklet!

@cezaraugusto
cezaraugusto / gpg_fix.txt
Last active Jul 9, 2020
fixing `gpg failed to sign data` error on macOS
View gpg_fix.txt
For troubleshooting, two things to first try:
run `git config --global gpg.program gpg2`, to make sure git uses gpg2 and not gpg
run `echo "test" | gpg2 --clearsign`, to make sure gpg2 itself is working
If that all looks all right, one next thing to try:
run `brew install pinentry` to ensure you have a good tool installed for passphrase entry
If after that install and you re-try git commit and still get the "failed to sign the data" error:
run `gpgconf --kill gpg-agent` to kill any running agent that might be hung
@nikhita
nikhita / update-golang.md
Last active Jul 3, 2020
How to update the Go version
View update-golang.md

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

View forgetme.js
class Parent extends React.Component {
constructor(...args) {
super(args);
this.state = {
renderChild: true
}
this.interval = null;
}
@ljharb
ljharb / array_iteration_thoughts.md
Last active Jul 10, 2020
Array iteration methods summarized
View array_iteration_thoughts.md

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

View blacklist
# Clickbait news sources
0.0.0.0 cnn.com
0.0.0.0 nypost.com
0.0.0.0 www.dailykos.com
0.0.0.0 www.dailymail.co.uk
0.0.0.0 www.drudgereport.com
0.0.0.0 www.foxnews.com
0.0.0.0 www.huffingtonpost.com
0.0.0.0 www.mirror.co.uk
@ChrisWellsWood
ChrisWellsWood / empty_rust_structs.md
Last active May 12, 2020
Initialising empty structs in Rust.
View empty_rust_structs.md

Initialising Empty Structs in Rust

In C/C++, you can initialise a struct without giving values for any of the fields:

struct Point {
  float x;
  float y;
  float z;
};
View Update-HostsFile.ps1
<#
Tested on Win7-64x and Powershell v5 & v4
maybe Set-ExecutionPolicy Unrestricted
msenturk - 24.02.2016
#>
# Create temp folder..
New-Item -ItemType Directory -Force -Path 'C:\Hosts\'
Set-Location C:\Hosts\
wget 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' -OutFile hosts
View postgres cheatsheet.md

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

You can’t perform that action at this time.