Skip to content

Instantly share code, notes, and snippets.

View crynobone's full-sized avatar
🖥️
Working

Mior Muhammad Zaki crynobone

🖥️
Working
View GitHub Profile
@crynobone
crynobone / caroussel.php
Created March 7, 2013 09:55
Simple Caroussel widget for Orchestra Platform.
<?php
class Caroussel extends Orchestra\Widget\Driver {
/**
* Type
*
* @access protected
* @var string
*/
@crynobone
crynobone / name-email.php
Created January 15, 2013 09:13
Simple Regular Expression to parse `NAME <email@address.com>`
<?php
$email = "Mior Muhammad Zaki <crynobone@gmail.com>";
if (preg_match('/^(.+\s)<(.*)>$/', $email, $matches))
{
$name = $matches[1];
$email = $matches[2];
}
@crynobone
crynobone / my.cnf
Created December 12, 2012 11:56
my.cnf configuration for Macbook Air using MAMP.
[mysqld]
default-storage-engine=InnoDB
collation-server=utf8_unicode_ci
character-set-server=utf8
init-connect='SET NAMES utf8'
table_cache=250
query_cache_size=0
query_cache_type=0
@crynobone
crynobone / oneauth_facebook.php
Created October 3, 2012 12:20
Sync Facebook Profile Picture to User's avatar
<?php
Event::listen('oneauth.logged', function ($client, $user_data)
{
if ($client->user_id > 0)
{
// get user information using eloquent.
$user = User::find($client->user_id);
$user->avatar = $user_data['info']['image'];
@crynobone
crynobone / oneauth-logged.php
Created August 28, 2012 16:18
Overwriting `oneauth.logged` default event listener
<?php
// In order to overwrite the default listener we must add the event overwrite
// after the bundle is started.
Event::listen('laravel.started: oneauth', function ()
{
Event::clear('oneauth.logged');
Event::listen('oneauth.logged', function ($client, $userdata)
{
@crynobone
crynobone / oneauth-sentry.php
Last active October 8, 2015 17:38
Allow OneAuth to use Sentry Auth Driver
<?php
/*
|--------------------------------------------------------------------------
| OneAuth IoC
|--------------------------------------------------------------------------
|
| Register Auth adapter as IoC, allow it to be replaced by any Authentication
| bundle that doesn't use Laravel\Auth\Drivers
*/
@crynobone
crynobone / multiselect.html
Created June 1, 2011 09:32
Retrieve and reassigning multiselect value
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
</head>
<body>
<select id="the-list" multiple="multiple">
<option id="list-1" value="1">Hello World</option>
@crynobone
crynobone / fuel-update.sh
Created April 27, 2011 14:45
Fuel Project Update File
#!/bin/bash
#
cd ~/htdocs/fuelphp
git checkout $1
echo 'start updating repository to master branch'
echo 'update fuel'
cd ~/htdocs/fuel/fuel
git checkout $1
@crynobone
crynobone / fuel.gitignore
Created April 26, 2011 07:01
Fuel Project standard .gitignore file
*~
*.bak
Thumbs.db
desktop.ini
.DS_Store
.buildpath
.project
.settings
fuel/app/config/db.php
fuel/app/logs/*/*/*
@crynobone
crynobone / Birthdate Parser.js
Created March 10, 2011 21:24
Malaysia Indentification Card Number to Birthdate
var ic = '090303086521';
if(ic.match(/^(\d{2})(\d{2})(\d{2})-?\d{2}-?\d{4}$/)) {
var year = RegExp.$1;
var month = RegExp.$2;
var day = RegExp.$3;
console.log(year, month, day);
var now = new Date().getFullYear().toString();