Skip to content

Instantly share code, notes, and snippets.

View shrink0r's full-sized avatar

Thorsten Schmitt-Rink shrink0r

View GitHub Profile
@prolic
prolic / benchmark.php
Created July 13, 2017 07:46
functional programming benchmarks in PHP
<?php
namespace f;
use ReflectionFunction;
const curry = 'f\curry';
function curry(callable $f, ...$args)
{
@learner-long-life
learner-long-life / Rinkeby.md
Last active August 30, 2022 22:32
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,

@burkeholland
burkeholland / gist:7475bb40a305d9f35494
Created April 1, 2015 20:44
Customizing The Navigation Bar / Status Bar

As I've been learning more and more about NativeScript, one of the first tasks I really dove into was learning how to customize the Navigation Bar for an iOS app. NativeScript has a Navbar component on the roadmap, but for now, it requires some knowledge about the underlying iOS implementation of UINavigationControllers, UIViewControllers and the like.  But fear not!  I have braved the treacherous waters of StackOverflow and the Objective-C docs and emerged, victorious and unscathed.

1

In this article, I’ll go over a few of the more common tweaks that you might be needing to make to the Navigation Bar or Status Bar. While NativeScript is a cross-platform framework, these tweaks apply specifically to iOS. However, most of the items that I will

@deiu
deiu / webcryptoapi.html
Last active November 18, 2024 01:55
Web Crypto API example: RSA keygen & export & import & sign & verify & encrypt & decrypt
<!-- MIT License -->
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
@graste
graste / UrlGeneratorInterface.php
Last active August 29, 2015 14:10
Route and URL generation in PHP frameworks
<?php
interface UrlGeneratorInterface
{
/**
* Generates a URL for the given route name and parameters. The options
* MAY be used to provide hints for the URL generation. This includes
* information about different parts of a URL, e.g. the scheme or port to
* use or whether absolute or relative URLs should be generated.
*
@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active November 2, 2024 12:19
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {
@jashkenas
jashkenas / semantic-pedantic.md
Last active November 20, 2024 06:09
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

@eulerfx
eulerfx / EventSourcingMonoids.fs
Last active May 17, 2024 15:09
F# event-sourcing with monoids
type Monoid<'a> = {
unit : 'a
op : 'a -> 'a -> 'a
}
let endo<'a> =
{ unit = id
op = fun (f:'a -> 'a) (g:'a -> 'a) -> f << g }
@graste
graste / agavi_routing_gen_options_presets.md
Last active August 29, 2015 13:57
Agavi Routing Options Presets

Agavi gen_options_presets

$route = $this->getContext()->getRouting()->gen('', array(), 'websocket_server');

Result:

ws://project.host.local:8080/
@graste
graste / gist:5204294
Last active December 15, 2015 04:50
Export puppet run on guest system via .dot as .svg to host system

Use --graph as option for puppet in Vagrantfile:

Vagrant::Config.run do |config|
  config.vm.define :devbox do |devbox|
    ...
    devbox.vm.customize ["modifyvm", :id, "--name", "trololo-devbox"]
    ...
    devbox.vm.provision :shell, :inline => "apt-get update --fix-missing"
    ...
 devbox.vm.provision :puppet do |puppet|