Skip to content

Instantly share code, notes, and snippets.

View burakerdem's full-sized avatar
🏠
Working from home

Burak Erdem burakerdem

🏠
Working from home
View GitHub Profile
@burakerdem
burakerdem / gist:1007450
Created June 4, 2011 01:38
PHP: ucwords() for UTF-8 strings
<?php
if (!function_exists('mb_ucwords'))
{
function mb_ucwords($str)
{
return mb_convert_case($str, MB_CASE_TITLE, "UTF-8");
}
}
@burakerdem
burakerdem / moneyformat.js
Created June 20, 2011 09:54
JS: Money Formatting
Number.prototype.formatMoney = function(c, d, t){
var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};
(123456789.12345).formatMoney(2, '.', ',');
@burakerdem
burakerdem / gist:1046201
Created June 25, 2011 05:38 — forked from brianblakely/gist:581868
HTML: Helpful HEAD content
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
@burakerdem
burakerdem / button.js
Created August 29, 2011 23:56
JS: Disabling/Enabling Button
$("input[type='submit']").attr("disabled", "disabled");
// $("input[type='submit']").removeAttr("disabled");
// won't work because IE has a bug
// instead use
$("input[type='submit']").prop("disabled", false);
@burakerdem
burakerdem / gist:2118088
Created March 19, 2012 16:27 — forked from o/gist:2116905
PHP: Localized date time example
<?php
// Check your supported locales with $ locale -a
setlocale(LC_TIME, 'tr_TR.UTF-8');
echo strftime("%d %B %Y %A");
// 19 Mart 2012 Pazartesi
@burakerdem
burakerdem / github_issues_to_csv.rb
Created June 13, 2012 09:25 — forked from tkarpinski/github_issues_to_csv.rb
Exports Github issues to CSV (API v3)
require 'octokit'
require 'csv'
require 'date'
# Github credentials to access your private project
USERNAME="USER_NAME"
PASSWORD="SEKRIT"
# Project you want to export issues from
USER="REPO_OWNER"
PROJECT="REPO_NAME"
@burakerdem
burakerdem / httpd-vhosts.conf
Created June 16, 2012 15:28
/etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName ci.localhost
DocumentRoot /Users/burakerdem/Sites/codeigniter/public
<Directory /Users/burakerdem/Sites/codeigniter/public>
Options Indexes FollowSymLinks
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
@burakerdem
burakerdem / hosts
Created June 16, 2012 15:44
/etc/hosts
127.0.0.1 ci.localhost
@burakerdem
burakerdem / config.php
Created June 16, 2012 16:50
application/config/config.php
$config['base_url'] = ‘http://ci.localhost/’;
@burakerdem
burakerdem / index.php
Created June 16, 2012 16:51
public/index.php
$system_path = ‘../system’;
$application_folder = ‘../application’;