Skip to content

Instantly share code, notes, and snippets.

View gr33ngr33n's full-sized avatar
🏠
πŸ‘πŸŒ³πŸŒ²πŸ”†

gr33ngr33n

🏠
πŸ‘πŸŒ³πŸŒ²πŸ”†
View GitHub Profile
@gr33ngr33n
gr33ngr33n / chmod-tutorial.md
Created May 31, 2021 04:11 — forked from cjaoude/chmod-tutorial.md
chmod tutorial / cheat sheet / cheatsheet / for dummies

chmod
Forget the chmod octals (the numbers). Set permission the easy way using the keywords

// know the ownerships:
u = User (you)
g = Group
o = Other (aka. 'World')
a = All of the above

@gr33ngr33n
gr33ngr33n / ListenToEventsTruffleAnyWeb3.js
Created April 1, 2021 16:05 — forked from sogoiii/ListenToEventsTruffleAnyWeb3.js
Example on how to use truffle to listen to events in your smart contracts
const Web3 = require('web3') // Web3 0.20.4 or web3 1 beta
const truffleContract = require("truffle-contract")
const contractArtifact = require('./build/contracts/TutorialToken.json')
const providerUrl = 'http://localhost:8545'
const provider = new Web3.providers.HttpProvider(providerUrl)
const contract = truffleContract(contractArtifact)
contract.setProvider(provider)
@gr33ngr33n
gr33ngr33n / CONCURRENCY.md
Created January 17, 2021 08:08 — forked from montanaflynn/CONCURRENCY.md
Examples of sequential, concurrent and parallel requests in node.js

Concurrency in JavaScript

Javascript is a programming language with a peculiar twist. Its event driven model means that nothing blocks and everything runs concurrently. This is not to be confused with the same type of concurrency as running in parallel on multiple cores. Javascript is single threaded so each program runs on a single core yet every line of code executes without waiting for anything to return. This sounds weird but it's true. If you want to have any type of sequential ordering you can use events, callbacks, or as of late promises.

@gr33ngr33n
gr33ngr33n / singleton.dart
Created November 17, 2020 10:48 — forked from theburningmonk/singleton.dart
Using Dart's factory constructor feature to implement the singleton pattern
class MyClass {
static final MyClass _singleton = new MyClass._internal();
factory MyClass() {
return _singleton;
}
MyClass._internal() {
... // initialization logic here
}