Skip to content

Instantly share code, notes, and snippets.

View ihsanberahim's full-sized avatar
💭
focusing on the strong base for long term

Muhammad Nur'Ihsan Bin Berahim ihsanberahim

💭
focusing on the strong base for long term
View GitHub Profile
<style>/***** Selector Hacks ******/ /* IE6 and below */* html #uno { color: red } /* IE7 */*:first-child+html #dos { color: red } /* IE7, FF, Saf, Opera */html>body #tres { color: red } /* IE8, FF, Saf, Opera (Everything but IE 6,7) */html>/**/body #cuatro { color: red } /* Opera 9.27 and below, safari 2 */html:first-child #cinco { color: red } /* Safari 2-3 */html[xmlns*=""] body:last-child #seis { color: red } /* safari 3+, chrome 1+, opera9+, ff 3.5+ */body:nth-of-type(1) #siete { color: red } /* safari 3+, chrome 1+, opera9+, ff 3.5+ */body:first-of-type #ocho { color: red } /* saf3+, chrome1+ */@media screen and (-webkit-min-device-pixel-ratio:0) { #diez { color: red }} /* iPhone / mobile webkit */@media screen and (max-device-width: 480px) { #veintiseis { color: red }} /* Safari 2 - 3.1 */html[xmlns*=""]:root #trece { color: red } /* Safari 2 - 3.1, Opera 9.25 */*|html[xmlns*=""] #catorce { color: red } /* Everything but IE6-8 */:root *> #quince { color: red } /* IE7 */*+html
var html = $('p').html();
$('p').html(html.replace(/world/gi, '<strong>$&</strong>'));
@ihsanberahim
ihsanberahim / script.js
Created October 25, 2013 04:50
email screenshot
/*
* For beta testing purposes create a camera button that can be set
* as the right nav button. Upon clicking create a screenshot and
* display the email dialog with pre-populated fields.
* This is a convenience for testers to send a screenshot straight
* out of the applicaiton.
*/
function createScreenShotButton() {
var buttonObjects = [
{image:'images/camera.png', width:45}
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<button onclick="javascript:popup('http://google.com','test',600,400)">Open</button>
</body>
</html>
@ihsanberahim
ihsanberahim / filters.php
Created November 11, 2013 11:12
Laravel 4 Route group filtering From http://paste.laravel.com/16ya
<?php
//Not work
Route::filter('test', function()
{
die('test filtered');
});
Route::when('test/*', 'test');
Route::get('test',function(){
return 'test';
});
@ihsanberahim
ihsanberahim / regex.php
Last active December 28, 2015 02:19
search money in text
<?php
$subject = '
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test
@ihsanberahim
ihsanberahim / helper.php
Created November 12, 2013 10:35
merge 2 array as column
<?php
$column1 = array(1,2,3,4);
$column2 = array('test','test','test','test');
$table = array();
//Example 1
/*foreach($column1 as $key => $row){
$table[] = array($column1[$key],$column2[$key]);
}*/
@ihsanberahim
ihsanberahim / filter.php
Created November 13, 2013 09:00
separate text by breakline
<?php
$subject = '
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test
RM 1,999.01 test RM 1,999.012121 test RM 1,999.01 test RM 1,999.012121 test
@ihsanberahim
ihsanberahim / demo.php
Created November 15, 2013 03:41
example of how static variable works
<?php
function repeatIt(){
static $id;
if(!$id) $id=0;
$id++;
echo sprintf('<div id="someprefix_%s">Butang %s</div>',$id,$id);
}
for($i=0;$i<10;$i++){
repeatIt();