Skip to content

Instantly share code, notes, and snippets.

View tobyS's full-sized avatar

Tobias Schlitt tobyS

View GitHub Profile
@tobyS
tobyS / minimal_range_example.jsx
Created November 30, 2018 14:21
Circular data cycle with range slider UI component in ReactJS
class PriceRange extends PureComponent {
constructor (props) {
super(props)
this.state = {
range: null,
}
}
// Overwrites the state if page just loaded or other
@tobyS
tobyS / commit-msg.php
Created June 1, 2018 08:37
Ticket number prefix without branch (reads .ticket file)
#!/usr/bin/php
# FILE: .git/hooks/commit-msg
<?php
$commitMessages = file($argv[1]);
if (preg_match('(^[0-9]+:\s*$)', $commitMessages[0])) {
echo "Empty commit message, aborting.\n";
exit(1);
}
@tobyS
tobyS / pre-push
Last active March 16, 2018 13:57
Asking the developer if he ran the tests before pushing
#!/bin/sh
# Allows us to read user input below, assigns stdin to keyboard
exec < /dev/tty
while true; do
read -p "[Pre-Push] Did you run the tests? (Y/n) " yn
if [ "$yn" = "" ]; then
yn='Y'
fi
Verifying that +tobiasschlitt is my blockchain ID. https://onename.com/tobiasschlitt
@tobyS
tobyS / vimmux
Created August 28, 2015 13:36
Re-attach to an existing VIM session in a new tab
#!/bin/bash
# alias vim="vimmux"
export TERM="xterm-256color"
if tmux has-session -t vim
then
if [ "$#" != "1" ]
then
3n 2n+1
n = 1: 3 3
n = 2: 6 5
n = 3: 9 7
...
@tobyS
tobyS / git-spull
Created January 29, 2014 07:59
Git commands to stash, pop stash & rebase by default. Just put the files (with the given names) into a bin-dir and make them executable. The use e.g. "$ git spush" instead of "$ git push".
#!/bin/bash
STASH_RESULT="`git stash`";
git pull --rebase
if `echo "$STASH_RESULT" | grep -q 'Saved working directory'`
then
git stash pop
fi
<?php
class PackageChanges extends \ArrayObject
{
/**
* @var string
*/
public $packageName;
/**
<FilesMatch "\.html$">
Allow from all
</FilesMatch>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /index.php [L]
<?php
abstract class SnakStorage
{
public function canStore( Snak $snak )
{
throw new \RuntimeException("Not implemented, yet.");
}
public function storeSnak( $snak, $snakRole /* ... */ )