This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://downloads.mongodb.org/linux/mong … -1.2.0.tgz | |
tar xvfz mongodb-linux-i686-1.2.0.tgz -C /usr/local/softnix/ | |
mv mongodb-linux-i686-1.2.0/ mongodb | |
mkdir -p /data/db | |
ln -s /usr/local/softnix/mongodb/bin/mongod /sbin/mongod | |
ln -s /usr/local/softnix/mongodb/bin/mongo /bin/mongo | |
./mongod & | |
./mongo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$depth = 0; | |
echo '<ol class="tree">'; | |
foreach ($children as $i => $child) | |
{ | |
// Get the last and next nodes | |
$last = isset($children[$i-1]) ? $children[$i-1] : $children[0]; | |
$next = isset($children[$i+1]) ? $children[$i+1] : $children[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/classes/kohana/exception.php b/classes/kohana/exception.php | |
index 7952a7b..657f661 100644 | |
--- a/classes/kohana/exception.php | |
+++ b/classes/kohana/exception.php | |
@@ -23,6 +23,8 @@ class Kohana_Exception extends Exception { | |
*/ | |
public function __construct($message, array $variables = NULL, $code = 0) | |
{ | |
+ $variables = array_map(array('HTML', 'chars'), $variables); | |
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Changing all files dates recursively | |
find . -exec touch -t 201005050900 {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Model_Core_Account extends Abstract_Model_Base { | |
public $list_fields = array(); | |
public function check() | |
{ | |
// validate list fields if exist, here! | |
// call parent model validation | |
return parent::check(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir ~/git/website.git && ~/git/cd website.git | |
git init --bare | |
mkdir ~/webapps/website | |
git config core.bare false | |
git config core.worktree /home/rafi/webapps/website ; NO TRAILING SLASH!!! Will screw up things real bad. | |
git config receive.denycurrentbranch ignore | |
; create a hook | |
cat > hooks/post-receive | |
#!/bin/sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# V-1.0 by Hanynowsky - April 2012. | |
# I am a very basic script that works around bug 874241 repprted in launchpad. | |
XCOM0=`xrandr -q | grep 'HDMI1 connected'` | |
XCOM1=`xrandr --output HDMI1 --primary --mode 1920x1080 --output LVDS1 --mode 1366x768 --below HDMI1` | |
XCOM2=`xrandr --output LVDS1 --mode 1366x768` | |
# if the external monitor is connected, then we tell XRANDR to set up an extended desktop | |
if [ -n "$XCOM0" ] || [ ! "$XCOM0" = "" ]; then echo $XCOM1 | |
# if the external monitor is disconnected, then we tell XRANDR to output only to the laptop screen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Trait MethodDelegator | |
{ | |
private $roles = array(); | |
private $method_map = array(); | |
public function delegate($class) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Trait MethodDelegator | |
{ | |
private $roles = array(); | |
private $method_map = array(); | |
public function delegate($class) | |
{ |