Skip to content

Instantly share code, notes, and snippets.

View mcgingras's full-sized avatar
🗻
snowy peak

Michael Gingras mcgingras

🗻
snowy peak
View GitHub Profile
@tyzbit
tyzbit / 1-Users and Use Cases.md
Last active April 23, 2018 05:03
Lightning Network Users and Use Cases

Lightning Network User Use Cases

The Lightning Network is a layer 2 payment network built on top of Bitcoin (and other cryptocurrencies).

It is denominated in the currency of the blockhain upon which it sits (first and primarily Bitcoin), and disputes are settled entirely by the base blockchain (Bitcoin).

Like Bitcoin, it is decentralized. Ultimately, the utility, speed and cost of the network will be defined by

#!/bin/bash
POST_INIT_SYNC_DELAY=60
POLL_DELAY=60
STALL_THRESHOLD=5
if [ -z `pidof btcd` ]; then
echo "Starting btcd"
nohup btcd &
sleep $POST_INIT_SYNC_DELAY
@dmpanch
dmpanch / howto_create_online_radio_macos_sierra.txt
Last active August 13, 2022 23:24
How to create internet radio on MacOS Sierra 10.12
All actions are performed in Terminal.app.
1. Install Homebrew http://brew.sh/
2. Install Jack (route audio tool) http://jackaudio.org/. Current stable version from official website doesn't work with
MacOS Sierra (I use 10.12.3) so you need to download beta version from there https://yadi.sk/d/JwT10b7v3Dm5yy.
After installing reboot your computer.
3. Install Darkice (audio streamer) via brew.
@arpit
arpit / cryptokitties.sol
Created January 23, 2018 21:33
Cryptokitties Contract from the Eth blockchain
pragma solidity ^0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
@anantn
anantn / firebase_player_assignment.js
Last active January 14, 2023 01:51
Firebase: Assigning players in a multiplayer game. This snippet assigns you a spot in a game if the game isn't full yet.
function go() {
var userId = prompt('Username?', 'Guest');
// Consider adding '/<unique id>' if you have multiple games.
var gameRef = new Firebase(GAME_LOCATION);
assignPlayerNumberAndPlayGame(userId, gameRef);
};
// The maximum number of players. If there are already
// NUM_PLAYERS assigned, users won't be able to join the game.
var NUM_PLAYERS = 4;

The Complete Guide to Nested Forms in Phoenix

I recently spent some time dealing with nested forms in Phoenix. Nested forms are great when you want to create multiple database records in a single transaction and associate them with each other. I am new to Phoenix and really struggled to find any resources that helped me with my specific problem. I decided to document what I learned in the process in hopes of helping others that are new to Elixir and Phoenix.

Here is my attempt at a one stop shop to learn everything you will need to know about nested forms. If you would like to view the GitHub repo you can check it out here.

Thanks to Heartbeat and Jose for excellent blog posts on nested forms. Also shoutout to Josh for showing me some examples at Ruby

@nickloewen
nickloewen / bret_victor-reading_list.md
Last active March 7, 2024 18:14
Bret Victor’s Reading List

This is a plain-text version of Bret Victor’s reading list. It was requested by hf on Hacker News.


Highly recommended things!

This is my five-star list. These are my favorite things in all the world.

A few of these works have had an extraordinary effect on my life or way of thinking. They get a sixth star. ★

@gaearon
gaearon / connect.js
Last active April 11, 2024 06:46
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@mfd
mfd / 06.png
Last active April 30, 2024 03:17
Gilroy font
06.png
@khalidx
khalidx / node-typescript-esm.md
Last active May 8, 2024 07:58
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json