Skip to content

Instantly share code, notes, and snippets.

View alkavan's full-sized avatar
😀
sup?

Igal Alkon alkavan

😀
sup?
View GitHub Profile
@alkavan
alkavan / git-bear-repo-deployment
Last active September 4, 2015 18:05 — forked from rafi/post-receive
Deploy with git
mkdir ~/git/website.git && cd ~/git/website.git
git init --bare
mkdir ~/webapps/website
git config receive.denycurrentbranch ignore
git config core.bare false
git config core.worktree ~/webapps/website ; NO TRAILING SLASH!!! Will screw up things real bad.
; create a hook
nano hooks/post-receive
$(document).ready(function() {
$('form').live('submit', function()
{
var form = $(this);
var action = form.attr('action');
$.post(action, form.serialize(), function(response)
{
form.replaceWith(response);
<?php defined('SYSPATH') or die('No direct script access.');
/**
* User to user communication wrapper. Uses Swift Mailer for email transport.
*
* @package Communicate
* @category Base
* @author Woody Gilk <[email protected]>
* @copyright (c) 2010 Woody Gilk
* @license MIT
*/
@shadowhand
shadowhand / install-kohana.sh
Created November 8, 2010 06:29
A script to install the Kohana PHP Framework
#!/bin/sh
# have submodules been added?
MODS=0
# Github base URL
GITHUB="https://github.com"
# Default branch
DEFAULT_BRANCH="3.0/master"
@alkavan
alkavan / linux_console_commands.sh
Last active August 29, 2023 11:23
All kind of useful Linux commands.
# I book marked some sites with useful Linux commands i found.
# then i noticed they were down, so i loaded them via google cache, and copied here.
# source: http://blog.urfix.com/
# source: http://www.pixelbeat.org/cmdline.html
# Enjoy!
# How to run process as background and never die
#
# nohup means: Do not terminate this process even when the stty is cut off.
# > /dev/null means: stdout goes to /dev/null (which is a dummy device that does not record any output).
@alkavan
alkavan / json.php
Created June 12, 2011 19:59
JSON Helper for Kohana v3
<?php defined('SYSPATH') or die('No direct script access.');
/**
* JSON helper class
*
* Examples:
* $j = JSON::decode('{"Organization": "Kohana"}'); // Good
* $j = JSON::decode("{'Organization': 'Kohana'}"); // Invalid
* $j = JSON::decode('{"Organization": "Kohana"}', NULL, 1); // depth stack exceeded
*
* @package Kohana
@alkavan
alkavan / build-php.sh
Created March 6, 2012 13:28
Compile PHP (on CentOS)
#!/bin/bash
# This is my compile command
# works good for me with PHP 5.3/5.4
# You might need this packages too (CentOS 5/6 tested)
#sudo yum install libxml2-devel.x86_64
#sudo yum install httpd-devel.x86_64
#sudo yum install openssl-devel.x86_64
@alkavan
alkavan / Makefile
Created December 7, 2012 18:44
basic makefile for c++ project
# basic makefile for c++ project
SOURCE=main.cpp your_include.h
MYPROGRAM=shellgap
MYINCLUDES=
MYLIBRARIES=
CC=g++
#------------------------------------------------------------------------------
@r-lyeh-archived
r-lyeh-archived / grid.hpp
Last active December 14, 2015 22:48
A 2D/3D collision grid
// A 2D/3D collision grid. MIT licensed
// - rlyeh, 2012
#pragma once
#include <map>
#include <set>
#include <cassert>
#include <tuple>
@r-lyeh-archived
r-lyeh-archived / compo.cpp
Last active December 9, 2019 06:28
Component-entity system in 16 lines of C++11. extract from kult engine (https://github.com/r-lyeh/kult)
#include <map> // Component-entity system in 16 lines of C++11. 2013 rlyeh, MIT licensed
#include <set> // Code fragment from kult engine - https://github.com/r-lyeh/kult
enum {JOIN,MERGE,EXCLUDE};using set=std::set<unsigned>;template<typename T> set&system(){
static set entities;return entities;}template<typename T,int MODE>set subsystem(const set
&B){set newset;const set&A=system<T>();if(MODE==MERGE){newset=B;for(auto&id:A)newset.ins\
ert(id);}else if(MODE==EXCLUDE){newset=B;for(auto&id:A)newset.erase(id);}else if(A.size()
<B.size()){for(auto&id:A)if(B.find(id)!=B.end())newset.insert(id);}else{for(auto&id:B)if(
A.find(id)!=A.end())newset.insert(id);}return newset;}template<typename T>std::map<unsig\
ned,T>&components(){static std::map<unsigned,T>objects;return objects;}template<typename\
T>bool has(unsigned id){return components<T>().find(id)!=components<T>().end();}templat\