Skip to content

Instantly share code, notes, and snippets.

View themasch's full-sized avatar

Mark Schmale themasch

View GitHub Profile
@themasch
themasch / build.sh
Created October 26, 2012 18:28
Simple build script. Who needs autoconf?
#!/bin/bash
######## defaults
EXECUTABLE_NAME="a.out"
LIBS=""
LOG_FILE="/tmp/$(basename $0).$RANDOM.log"
COMPILE_OPTS=""
LINK_OPTS=""
if [ "$1" == "debug" ]
@themasch
themasch / gist:4069769
Created November 14, 2012 01:57
idea: javascript annotation powered controllers (for express)
Controller.create('Test', {
/**
* @Route('/')
*/
indexAction: function(req, res)
{
},
@themasch
themasch / bla.html
Created December 5, 2012 14:30
security questions made easy (with bootstrap)
<a href="/delete/stuff" class="btn btn-delete" data-sure-text="sure?"> delete </a>
@themasch
themasch / Preferences.sublime-settings
Last active December 11, 2015 00:08
my sublime config
{
"auto_complete_commit_on_tab": true,
"caret_style": "smooth",
"color_scheme": "Packages/Theme - Phoenix/Color Scheme/Tomorrow-Night.tmTheme",
"detect_slow_plugins": false,
"draw_minimap_border": true,
"ensure_newline_at_eof_on_save": true,
"font_face": "Source Code Pro",
"font_size": 11,
"ignored_packages":
@themasch
themasch / dateinterval.php
Last active December 15, 2015 07:59
stringify PHP DateInterval
<?php
function stringifyDateInterval(\DateInterval $inv)
{
$dat = 'P' . (($inv->y !== 0) ? $inv->y . 'Y' : '')
. (($inv->m !== 0) ? $inv->m . 'M' : '')
. (($inv->d !== 0) ? $inv->d . 'D' : '');
$tme = 'T' . (($inv->h !== 0) ? $inv->h . 'H' : '')
. (($inv->i !== 0) ? $inv->i . 'M' : '')
<?php
$array_a = [ 'a' => 'red', '42', true];
$array_b = [ 'blue', 42, 'true'];
var_dump(array_intersect($array_a, $array_b)); // [ '42' ]
var_dump(array_filter($array_a, function($v) use ($array_b) {
return(in_array($v, $array_b));
})); // [ '42', true ]
fn fibbo(max: int, cb: fn(int) -> bool) {
let mut a = 1;
let mut b = 0;
let mut c;
loop {
c = a;
a = a+b;
b = c;
@themasch
themasch / recursemd5.sh
Created April 24, 2013 17:17
recurse md5
#!/bin/sh
walk_dir() {
if [[ -e MD5SUM ]]
then
md5sum -c MD5SUM
else
for FILE in `ls .`;
do
if [[ -d $FILE ]]
@themasch
themasch / streamthingy.js
Created May 3, 2013 16:59
Just a quick scribble..
var stream = new StreamThingy()
stream.transform = myCrazyFormater
io.sockets.on('connection', function(socket) {
stream.add(socket)
})
stream.pipe(process.stdout)
@themasch
themasch / concept.md
Last active December 17, 2015 09:09
Konzept: PodHost (was ein scheiß Name)

Blabla gibts schon. Hat sich erledigt. Ich bin blöd

Die Idee:

PodHost soll ein SaaS (oder WSaaS) Projekt werden das sich dem Hosten von Podcasts widmet. Der User (Podcaster) kann sich seinen einen Blog gestalten und dort ohne viel technischen Sachverstand mit minimalem Aufwand Podcasts veröffentlichen. Hosting, speicherung der Daten, veröffentlichen der Feeds etc. übernimmt PodHost.

Features:

  • Backend zum Verwalten des Blogs, anlegen von Artikeln, einsehen von Statistiken etc.