Skip to content

Instantly share code, notes, and snippets.

View heimdallrj's full-sized avatar

Indika heimdallrj

  • Berlin
  • 00:00 (UTC -12:00)
View GitHub Profile
@moyaldror
moyaldror / remove_git_submodule.sh
Last active August 3, 2021 04:51
Complete remove of git submoule
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 <submodule full name>"
exit 1
fi
MODULE_NAME=$1
MODULE_NAME_FOR_SED=$(echo $MODULE_NAME | sed -e 's/\//\\\//g')
@lakshin
lakshin / multirequire.js
Last active November 24, 2017 18:13
Use multiple package versions in one node project
//server.js
const http = require('http');
//const niv = require('npm-install-version');
const chalkv2 = require('chalk');
const multiRequire = require('./multiRequire');
const chalkv1 = multiRequire().multiRequire('chalk','1.0.0');
console.log('chalk v1'+chalkv1.blue(chalkv1.version));
console.log('chalk v2'+chalkv2.blue(chalkv2.version));
const hostname = '127.0.0.1';
@yocontra
yocontra / aoe2hd.md
Last active June 9, 2023 18:28
Age of Empires II HD - For Mac OSX
// reducer.js
let initialState = 0;
function reducer (state=initialState, action) {
switch(action.type){
case 'INCREMENT_COUNT':
return state + 1;
default:
return state
}
import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash

Follow the dirty money

A shady Internet business has been discovered.

The website has been made public by a whistle blower. We have enough evidence about the dirty deals they did. But to charge them we need to get hands on precise numbers about the transactions that happened on their platform.

Unfortunately no record of the transactions could be seized so far. The only hint we have is this one transaction:

@wojteklu
wojteklu / clean_code.md
Last active September 19, 2024 22:29
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@jaredhowland
jaredhowland / clear-font-cache.md
Last active September 18, 2024 10:55
Clear Mac OS X Font Caches
@adam-p
adam-p / Local PR test and merge.md
Last active August 3, 2024 16:45
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@allenwb
allenwb / 0Option2ConstructorSummary.md
Last active November 4, 2023 14:39
New ES6 constructor features and semantics: Alternative 2 manual super in derived classes

New ES6 Constructor Semantics and Usage Examples

Manual super: Alternative Design where subclass constructors do not automatically call superclass constructors

This Gist presents a new design of class-based object construction in ES6 that does not require use of the two-phase @@create protocol.

One of the characteristics of this proposal is that subclass constructors must explicitly super invoke their superclass's constructor if they wish to use the base class' object allocation and initialization logic.

An alternative version of this design automatically invokes the base constructor in most situations.