Skip to content

Instantly share code, notes, and snippets.

View shrink0r's full-sized avatar

Thorsten Schmitt-Rink shrink0r

View GitHub Profile
@shrink0r
shrink0r / regex_test.php
Created July 25, 2012 22:17
Readable regex playing around with named groups.
<?php
$pattern = <<<EOT
/
(?(DEFINE)
(?<T_NUM> [0-9] )
)
^(?&T_NUM)$
/x
EOT;
@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|
@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/
@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 }
@jashkenas
jashkenas / semantic-pedantic.md
Last active July 13, 2024 04:25
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

@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active January 16, 2024 01:17
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] {
@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.
*
@deiu
deiu / webcryptoapi.html
Last active July 9, 2024 08:18
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)
})
@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

@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,