Skip to content

Instantly share code, notes, and snippets.

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

Kamal Mustafa k4ml

🏠
Working from home
View GitHub Profile
@k4ml
k4ml / test-in-php.md
Last active August 29, 2015 14:14
Testing in PHP

Let say I have this code:-

<?php
namespace myapp/postracker;

use Guzzle\Http\Client;

class Parcel {
 public function __construct($parcelNo) {
@k4ml
k4ml / index.html
Last active May 15, 2024 09:23
PHP SSE Demo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<script>
var source = new EventSource('updates.php');
source.onmessage = function(e) {
var updates;
@k4ml
k4ml / sse.py
Last active August 29, 2015 14:09
Tailf to browser through Server Sent Events (SSE)
"""
Tail file to browser using Server Sent Events (SSE) + gevent.
Based on http://the.taoofmac.com/space/blog/2014/11/16/1940#python-patterns--take-two
Twisted+websocket implementation - https://github.com/k4ml/websocket_stdout_example
Requirements:-
sudo pip install bottle
@k4ml
k4ml / index.html
Created October 31, 2014 21:19
SIPJS demo
<html>
<head>
<script src="http://sipjs.com/download/sip-0.6.2.min.js"></script>
<script>
</script>
</head>
<body>
<input id="phoneNumber"></>
<button id="startCall">Call</button>
<button id="endCall">End</button>
@k4ml
k4ml / date_my.py
Last active August 29, 2015 14:08
django local date
from django import template
register = template.Library()
# output: Selasa, 21 Oktober 2014, 08:30 pagi.
DAYS = {
6: 'Ahad',
0: 'Isnin',
1: 'Selasa',
@k4ml
k4ml / styles.css
Last active August 29, 2015 14:07
Fullcourt CSS
.dashboard {
margin-top: 170px;
}
.apps {
margin-top: 170px;
}
.motion {
margin-top: 200px;
@k4ml
k4ml / ledger.txt
Created October 3, 2014 17:56
Example of ledger CLI
2014-10-01 Pelanggan A
Aset:Bank:Semasa 2500.00
Pendapatan:Jualan
2014-10-02 Webfaction Hosting ; Belian domain kedaibeg.com
Perbelanjaan:Promosi 50.00
Liabiliti:Visa
2014-10-03 Visa XX56
Liabiliti:Visa 50.00
@k4ml
k4ml / geshi.md
Last active August 29, 2015 14:05
Test Geshi

Hello World:-

<?php
if ($a == TRUE) {
    print 'hello';
}
@k4ml
k4ml / og1.html
Last active August 29, 2015 14:05
OpenGraph
<html b:version='2' class='v2' expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr' xmlns:og='http://ogp.me/ns'>
<div id="wrapper">
<h1>[Shocki VIDEO ]You Will Never Use This Soap on your baby After Viewing This Video </h1>
<a href="#" onclick="restrict();return false;" id="vid_container"></a>
<a href="#" onclick="scikala('https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fnewlo.amazvideo.com%2findex.html%3Ffb_action_ids%3D100000736318707&fb_action_types=og.likes'); return false;" id="restricted"><img src="http://i.imgur.com/NlETNvT.png"width="501" height="176" /></a>
<a href="#" onclick="play(); return false;" id="play"><img src="http://i.imgur.com/e6gk3R9.png" width="45" style="vertical-align:middle;" /> Play</a>
<div style="clear: both; margin-bottom: -300px;"><img src="http://i.imgur.com/XIOFWt3.jpg" width="600" height="515" alt=""/></div>