Skip to content

Instantly share code, notes, and snippets.

@Cacodaimon
Cacodaimon / Markdown-Cheatsheet.md
Last active September 25, 2020 02:10
PHP simple markdown parser performance test
@Cacodaimon
Cacodaimon / .bashrc
Last active December 7, 2020 22:33
A powerline inspired bashrc
#!/bin/bash
[ -z "$PS1" ] && return
# ~/.local/share/fonts/
# https://github.com/powerline/fonts
color_black_black='\[\e[0;30m\]'
color_black_red='\[\e[0;31m\]'
color_black_green='\[\e[0;32m\]'
@Cacodaimon
Cacodaimon / Commands
Last active August 29, 2015 14:05
CacoCloud Dockerfile
sudo docker build -t="caco-cloud" .
sudo docker run -p 6060:443 caco-cloud
sudo docker run -v /home/caco/tmp/:/var/www/caco-cloud/database -d -p 6060:443 caco-cloud
@Cacodaimon
Cacodaimon / Install
Last active February 19, 2016 07:04
Caco Cloud Installation on DigitalOcean Debian 7
#Follow these steps to install CacoCloud:
#Login
ssh -i .ssh/id_rsa_home root@
#Install all packages
apt-get install git apache2 sqlite3 php5 php5-imap php5-mcrypt php5-sqlite php5-curl
#Create a self signed cert
mkdir /etc/apache2/ssl
@Cacodaimon
Cacodaimon / key-bindings-user.json
Created March 1, 2014 12:49
SublimeText3 german keyboard show console keybinding.
[
{ "keys": ["ctrl+^"], "command": "show_panel", "args": {"panel": "console", "toggle": true} }
]
#!/bin/bash
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=10000
HISTFILESIZE=20000
export EDITOR=nano
alias ls='ls --color'
alias ll='ls -lah'
alias ssh='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"font_face": "DroidSansMono",
"font_size": 12,
"highlight_line": true,
"highlight_modified_tabs": true,
"line_padding_bottom": 1,
"line_padding_top": 1,
"spell_check": true,
"tab_size": 4,
@Cacodaimon
Cacodaimon / SlimJsonView.php
Created November 5, 2013 15:42
Tiny slim json view.
class SlimJsonView extends \Slim\View
{
public function render($template = null)
{
$app = \Slim\Slim::getInstance();
!$this->has('error') && $this->data->remove('flash');
!$this->has('flash') && $this->data->remove('flash');
$app->response()->header('Content-Type', 'application/json');
@Cacodaimon
Cacodaimon / SumByKey.js
Created November 4, 2013 21:12
A simple AngularJS filter for summarizing the values of an array containing objects by a key.
angular.module('caco.feed.filter', [])
.filter('sumByKey', function() {
return function(data, key) {
if (typeof(data) === 'undefined' || typeof(key) === 'undefined') {
return 0;
}
var sum = 0;
for (var i = data.length - 1; i >= 0; i--) {
sum += parseInt(data[i][key]);
@Cacodaimon
Cacodaimon / validate_by_docblock
Created October 24, 2013 11:38
Quick and dirtyphp docblock based validation prototype...
<?php
abstract class Validate
{
public abstract function isValid($value);
}
class ValidateInt extends Validate
{
public function isValid($value)