Skip to content

Instantly share code, notes, and snippets.

View zeuxisoo's full-sized avatar
🛥️
No response

Zeuxis zeuxisoo

🛥️
No response
View GitHub Profile
@zeuxisoo
zeuxisoo / reddit-ranking-algorithms.php
Created March 23, 2011 09:06
Reddit Ranking Algorithms in PHP
<?php
// Zeuxis Lo
// Created at 2011-03-23 05:05 PM
date_default_timezone_set("Asia/Hong_Kong");
function calculate_rank_sum($score, $created_at) {
$order = log10(max(abs($score), 1));
if ($score > 0) {
@zeuxisoo
zeuxisoo / Exchange-Variable.php
Created March 24, 2011 05:49
Is best way to exchange variable?
<?php
/*
* Code A
* ----
* It also create temp variable, but not see in coding?
*/
list($a, $b) = array($b, $a);
/*
@zeuxisoo
zeuxisoo / ReadMe.txt
Created April 8, 2011 15:28
Simple upload and resize image on PHP
- attachment
- 1.jpg
- 2.jpg
...
...
...
- index.php
- resize_image.php
- uploader.php
@zeuxisoo
zeuxisoo / bash_profile
Created April 12, 2011 01:44
Personal ~/.bashrc config
if [ -f ~/.bashrc ]
then
source ~/.bashrc
fi
@zeuxisoo
zeuxisoo / vimrc
Created April 12, 2011 07:14
simply vimrc
set ruler
set number
set hlsearch
set incsearch
set nocompatible
set backspace=start,indent,eol
set cin
set tabstop=4
set shiftwidth=4
"set smartindent
@zeuxisoo
zeuxisoo / genpw.sh
Created April 12, 2011 08:14
bashrc gen random password function
genpw() {
local l=$1
[ "$l" == "" ] && l=16
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}
@zeuxisoo
zeuxisoo / MAMP with Python-MySQLdb.txt
Created April 13, 2011 08:56
MAMP + Python-MySQLdb
1. Goto http://dev.mysql.com/downloads/mysql/
2. Select Platform: "Mac OS X"
3. Download mysql-5.5.11-osx10.6-x86.tar.gz
(Mac OS X ver. 10.6 (x86, 32-bit), Compressed TAR Archive)
4. Unzip it
5. Copy include folder into /Applications/MAMP/Library
6. Copy lib/* files into /Applications/MAMP/Library/lib
----
1. Goto http://sourceforge.net/projects/mysql-python/
@zeuxisoo
zeuxisoo / TextWrangler Script AppendHeader.scpt
Created April 15, 2011 04:41
Append header on top of document
# Neo.Lo
# 2011-04-15 12:38:10 PM
tell application "TextWrangler"
set author to "Neo.Lo"
set website to "http://studio.zeuik.com/"
set wrap to 80
set out to {}
set end of out to " * Name : " & name of document 1
@zeuxisoo
zeuxisoo / TextWrangler Insert Date Time.scpt
Created April 15, 2011 04:43
Insert date time value to the document content
tell application "TextWrangler"
set selection to (do shell script "date +\"%Y-%m-%d %r\"|sed 's/ / /g'")
end tell
@zeuxisoo
zeuxisoo / git --no-ff settings.txt
Created April 15, 2011 05:06
How do I make git merge's default be --no-ff --no-commit?
git config --global user.name "Your Name"
git config --global core.mergeoptions "--no-ff"