Skip to content

Instantly share code, notes, and snippets.

View raimohanska's full-sized avatar

Juha Paananen raimohanska

View GitHub Profile
@joepie91
joepie91 / no-your-cryptocurrency-cannot-work.md
Last active April 13, 2024 03:21
No, your cryptocurrency cannot work

No, your cryptocurrency cannot work

Whenever the topic of Bitcoin's energy usage comes up, there's always a flood of hastily-constructed comments by people claiming that their favourite cryptocurrency isn't like Bitcoin, that their favourite cryptocurrency is energy-efficient and scalable and whatnot.

They're wrong, and are quite possibly trying to scam you. Let's look at why.

What is a cryptocurrency anyway?

There are plenty of intricate and complex articles trying to convince you that cryptocurrencies are the future. They usually heavily use jargon and vague terms, make vague promises, and generally give you a sense that there must be something there, but you always come away from them more confused than you were before.

@PaulWoodIII
PaulWoodIII / CurrentValueSubjectToBinding.swift
Last active January 9, 2024 01:20
Bindings over a CurrentValue subject allow you to use combine for side affects
//: [Previous](@previous)
import Foundation
import SwiftUI
import Combine
//: Current Value Subject is a value, a publisher and a subscriber all in one
let currentValueSubject = CurrentValueSubject<Bool, Never>(true)
print(currentValueSubject.value)
@enepomnyaschih
enepomnyaschih / base64.js
Last active March 6, 2024 23:45
https://www.npmjs.com/package/byte-base64 - Encode JS Uint8Array, simple array of bytes or native JS string to base64 and back
/*
MIT License
Copyright (c) 2020 Egor Nepomnyaschih
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@fearthecowboy
fearthecowboy / extensions.cs
Created June 16, 2014 15:24
Handy IEnumerator<T> extension methods
public static IEnumerable<T> ToIEnumerable<T>(this IEnumerator<T> enumerator) {
if (enumerator != null) {
while (enumerator.MoveNext()) {
yield return enumerator.Current;
}
}
}
public static T[] ToArray<T>(this IEnumerator<T> enumerator) {
return ToIEnumerable<T>(enumerator).ToArray();
@laurilehmijoki
laurilehmijoki / use-system-clipboard-with-vim.md
Last active August 29, 2015 13:56
Use system clipboard with VIM

Problem

The "integrate VIM with the system clipboard" feature does not work on OS X 10.8+ and VIM 7.3.

Solution

  • Compile VIM from source
  • Enable the system-clipboard integartion in .vimrc

Compile VIM

@poshaughnessy
poshaughnessy / app.js
Created January 31, 2012 09:28
Simple static site on Heroku with Node.js
var express = require('express');
var port = process.env.PORT || 3000;
var app = express.createServer();
app.get('/', function(request, response) {
response.sendfile(__dirname + '/index.html');
}).configure(function() {
app.use('/images', express.static(__dirname + '/images'));
}).listen(port);
@komu
komu / river.lhs
Last active September 27, 2015 17:38
Crossing a river with Haskell
> {-# OPTIONS -Wall -XMultiParamTypeClasses -XFunctionalDependencies -XTypeSynonymInstances #-}
> module Main where
8 people are standing on a west bank of a river and must cross to the
other side using a boat. However,
- the boat carries at most 2 people at a time,
- the father can't be left with the girls without the mother,
- the mother can't be left with the boys without the father,
- the prisoner can't be left with any family members without the police,
@jonifreeman
jonifreeman / gist:1151994
Created August 17, 2011 16:50
JsonDSL vs. JsonAST
("lotto" ->
("lotto-id" -> lotto.id) ~
("winning-numbers" -> lotto.winningNumbers) ~
("winners" ->
lotto.winners.map { w =>
(("winner-id" -> w.id) ~
("numbers" -> w.numbers))}))
// vs.