Skip to content

Instantly share code, notes, and snippets.

<?php phpinfo(); ?>
gist: 122861
for i in `find . -name "*.png"` ; do optipng -o7 $i ; done
gist: 122859
# coding: utf-8
require "rango"
<?php
require_once '/Users/egi/Sites/libs/adodb5/adodb.inc.php';
mb_internal_encoding('UTF-8');
header('Content-type: text/html; charset=UTF-8');
$g_dbconn = ADONewConnection('mysql');
$g_dbconn->debug = true;
$g_dbconn->Connect('localhost', 'root', '', 'th');
<?php
if (isset($_POST['submit']))
{
$answers = array('founder'=>'Albus Dumbledore', 'spell'=>'Alohomora', 'friend'=>'Ginny Weasley');
foreach ($answers as $question_id=>$answer)
{
if (!isset($_POST['answers'][$question_id]) || $_POST['answers'][$question_id] != $answer)
{
// kalo ada satu aja yang salah, langsung lempar ke sini
@egi
egi / gist:959852
Created May 6, 2011 21:47
move icross add
<?php
function channel_shift($channel)
{
$tomorrow = $channel->since + 86400;
if (0 < channel_count(array('type'=>$channel->type, 'time'=>$tomorrow)))
{
$aChannels = $channel->load(array('since'=>$tomorrow));
foreach ($aChannels as $ch)
channel_shift($ch);
<?php
/**
* diketahui tanggal tertentu (dalam YYYY-mm-dd), keluarkan semua minggu yang
* dalam range-nya memiliki tanggal di dalam bulan berjalan. minggu dimulai dari
* hari senin.
*
* @author Agastiya S. Mohammad <[email protected]>
**/
@egi
egi / gist:1370233
Created November 16, 2011 14:53 — forked from chartjes/gist:1370214
Need help with a MySQL query
I have the following query:
SELECT COUNT( DISTINCT ( brand.id )), MONTH(u.created_at)
FROM brand
LEFT JOIN brand_admin_group bag ON brand.id = bag.brand_id
LEFT JOIN brand_admin_group_membership bagm ON bag.id = bagm.brand_admin_group_id
LEFT JOIN user u ON bagm.user_id = u.id
GROUP BY MONTH(u.created_at)
Results look like this:
# (If it takes more than 10 seconds to load my pages, something is wrong)
Timeout 10
# (Note: I can set this lower if I know other processes will need more memory under load)
MaxClients 40
# (My site gets almost no traffic)
MinSpareServers 4
# (My server never uses memory, so extra apache children hanging around doesnot hurt me)
MaxSpareServers 20
<WSSMessage xmlns="com/icare/eai/schema/evWSSGetServiceClassAIRResp">
<WSSGetServiceClassAIRResp>
<ServiceNumber>6281450010213</ServiceNumber>
<Status>Success</Status>
<ErrorMessage/>
<ServiceClass>
<SCCode>7900</SCCode>
</ServiceClass>
</WSSGetServiceClassAIRResp>
</WSSMessage>
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"/>
<soapenv:Body>
<get:GetSubsInfoResponse
xmlns:get="http://www.example.org/GetSubsInfo/">
<Tid>628588190194720130507124218</Tid>
<Msisdn>6281519307097</Msisdn>