Skip to content

Instantly share code, notes, and snippets.


Robert Costa zabbarob

  • Osnabrück, Germany
View GitHub Profile
zabbarob / window-metrics.reg
Created Jun 29, 2013
Sets various metrics for the Windows 8 GUI, like size of title bar and title bar font, size of scroll bar, border width and desktop icon spacing.
View window-metrics.reg
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics]
View new_gist_file
def flatten(l):
for el in l:
if isinstance(el, collections.Iterable) and not isinstance(el, basestring):
for sub in flatten(el):
yield sub
yield el
def which(program):
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
View new_gist_file
function toWindows1252(string, replacement)
var ret = new Array(string.length);
var i, ch;
replacement = typeof replacement === "string" && replacement.length > 0 ? replacement.charCodeAt(0) : 0;
for (i = 0; i < string.length; i++)
ch = string.charCodeAt(i);
zabbarob / echovars.php
Created Dec 31, 2013
Web page that prints out the contents of most predefined variables in PHP.
View echovars.php
header('Content-Type: text/plain');
function echoAll($a, $n) {
if ($a) {
echo join(PHP_EOL, array_map(function($key) use ($a, $n) {
return $n . "['$key'] = '$a[$key]';";
}, array_keys($a))), PHP_EOL;
zabbarob / MemoryDbTest.php
Last active Aug 20, 2016
Use in-memory database when running tests for a Laravel application.
View MemoryDbTest.php
use Illuminate\Support\Facades\Artisan;
class MemoryDbTest extends \TestCase
public function setUp()
// optional: Artisan::call('db:seed', ['--class' => 'TestSeeder'])
zabbarob /
Last active Aug 20, 2016
Update packages of various package managers on OS X
#!/usr/bin/env bash
# Updates packages of various package managers on macOS
function myprintf() {
printf "\e[0;35m$1\e[0;m\n"
myprintf "Updating Homebrew Packages"
brew update
brew upgrade
zabbarob /
Created Aug 20, 2016
Clean cached downloads of various package managers on OS X
#!/usr/bin/env bash
# Cleans cached downloads of various package managers on OS X
function myprintf() {
printf "\e[0;35m$1\e[0;m\n"
myprintf "Cleaning Homebrew Packages"
brew cleanup
brew cask cleanup
View load_excel.php
$sheets = Excel::load($filename)->get();
$firstSheet = $sheets->first();
$header = $firstSheet->first();
$data = $firstSheet->slice(1)->map(function ($row) use ($header) {
return $header->combine($row);
zabbarob / anki.css
Created May 7, 2013
Anki cards, CSS and HTML templates.
View anki.css
@font-face {
font-family: junicode;
src: url('_junicode.ttf');
.card, table {
font-family: Helvetica, sans-serif, junicode;
font-size: 20px;
text-align: center;
color: #d03030;
background-color: #fafaf5;