Skip to content

Instantly share code, notes, and snippets.

View cebe's full-sized avatar
☁️
working on cebe.cloud

Carsten Brandt cebe

☁️
working on cebe.cloud
View GitHub Profile
@igorw
igorw / vm.php
Last active August 29, 2015 14:03
My stack machine from cute little interpreters at dpc14.
<?hh
// examples:
//
// ~$ echo '1 jnz(:start) :foo call(:bar) ret :bar 42 print ret :start call(:foo)' | hhvm vm.php
// float(42)
//
// ~$ echo '3 :loop 1 - print jnz(:loop)' | hhvm vm.php
// float(2)
// float(1)
<?php
/**
* Feb 2014
* @author Pascal Brewing
* @email <[email protected]>
* @package common\helpers
* Class MediaContentHelper
*/
namespace common\modules\mediating\helpers;
class InfiniteScrollLinkPager extends CLinkPager
{
public $htmlOptions=array();
/**
* Initializes the pager by setting some default property values.
*/
public function init()
{
@igorw
igorw / turel.clj
Last active August 29, 2015 13:57
(ns turel.core
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn not-membero
[x l]
(conde [(emptyo l)]
[(fresh [head tail]
(conso head tail l)
(!= head x)
@kimus
kimus / ufw.md
Created March 2, 2014 22:46
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@renoirb
renoirb / files-ssl.cnf
Last active March 3, 2025 01:02
Creating on a server MySQL configuration. Using those three
[client]
ssl
ssl-ca=/etc/mysql/ca-cert.pem
ssl-cert=/etc/mysql/client-cert.pem
ssl-key=/etc/mysql/client-key.pem
[mysqld]
ssl
ssl-cipher=DHE-RSA-AES256-SHA
ssl-ca=/etc/mysql/ca-cert.pem
@cebe
cebe / .xbindkeysrc
Created November 28, 2013 16:06
Swapping the PageUp,PageDown keys with Pos1,End on Lenovo keyboard. The Lenovo T530 has the pageup and pagedown keys placed directly over the arrow keys left and right. Navigation is quite unintuitive this way as I expect the Pos1 and End keys there to go to the start and end of the line. You'll need xdotool and xbindkeys: `sudo apt-get install …
// using the KP_* keys here to emulate behavior
// otherwise this will result in an endless loop
"xdotool key KP_Home"
Release+Prior
"xdotool key KP_End"
Release+Next
"xdotool key KP_Prior"
Release+Home
"xdotool key KP_Next"
Release+End
@cebe
cebe / json.php
Created June 14, 2013 22:24
This is how json_encode() treats arrays...
<?php
$a = new StdClass();
$a->prop = 2;
$a->str = "hallo";
$a->arr = array(1,2,3);
echo json_encode($a); // {"prop":2,"str":"hallo","arr":[1,2,3]}
echo json_encode((array)$a); // {"prop":2,"str":"hallo","arr":[1,2,3]}
echo json_encode(array(1,2,3)); // [1,2,3]
@cebe
cebe / main.php
Last active June 21, 2019 09:25
REST routing with Yii 2 UrlManager
<?php
return array(
/* ... */
'components' => array(
/* ... */
'urlManager' => array(
'enablePrettyUrl' => true,
'rules' => require(__DIR__ . '/routes.php'),
),
@karmi
karmi / .gitignore
Last active August 24, 2020 09:25
Elasticat makes Elasticsearch JSON responses pretty • http://git.io/elasticat
.DS_Store
tmp/