Skip to content

Instantly share code, notes, and snippets.

View ahmadshah's full-sized avatar
:octocat:
Yo!

Ahmad Shah Hafizan Hamidin ahmadshah

:octocat:
Yo!
View GitHub Profile
casper.test.begin('Test tax incentive login page', 2, function (test) {
casper.start('http://dev.taxincentive.flexworklife.my', function () {
test.assertTitle('Flexworklife - Tax Incentive', 'Page title is correct');
test.assertExists('form', 'Login form exists');
});
casper.run(function () {
test.done();
});
});
Event::listen('auth.login', function ($user) {
if ($user->name === 'Ahmad') {
$user->name = 'Ahmad Shah';
}
});
@ahmadshah
ahmadshah / User.php
Created May 18, 2014 20:12
Orchestra\HTML Table
<?php namespace Eisai\Foundation\Presenter;
use Orchestra\Support\Str;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\HTML;
use Orchestra\Support\Facades\Form;
use Orchestra\Support\Facades\Table;
use Orchestra\Html\Table\TableBuilder;
use Orchestra\Foundation\Presenter\AbstractablePresenter;
@ahmadshah
ahmadshah / FooController.php
Created May 20, 2014 18:50
Load theme manually in controller action
<?php
use Orchestra\Support\Facades\Theme;
class FooController extends BaseController {
public function show($moduleSlug)
{
Theme::setTheme('module');
return View::make('eisai/module::show');
@ahmadshah
ahmadshah / Scheduler.php
Last active August 29, 2015 14:01
Date Recurring Scheduler By Month
<?php
use \Exception;
use Carbon\Carbon;
class Scheduler {
/**
* Scheduler starting date
*
@ahmadshah
ahmadshah / cheatsheet.md
Last active August 29, 2015 14:02
Eisai Markdown Extra

###Learning objective box [open .objectives]-content-[close]

###Glossary text [open a .glossary]**glossary text**[close a]

###Flash forward pink box [open .objective.flash-forward]-content-[close]

###Did you know blue box

@ahmadshah
ahmadshah / AbstractableNotifier.php
Last active August 29, 2015 14:07
Email notifier
<?php namespace Support\Notifier;
use Model\User;
use Illuminate\Support\Arr;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
abstract class AbstractableNotifier {
/**
* Expression language component
@ahmadshah
ahmadshah / db-backup.sh
Last active August 29, 2015 14:10
MySQL full backup
#!/bin/bash
#Database Connection
DBUSER=""
DBPASSWORD=""
DBNAME=""
#Location to save
BACKUPDIR="/opt/backup/database"
BACKUPPATH=$(date +"%m-%Y")
$source = ['1:8', '2:8', '1:9', '2:9', '3:1'];
$cleanArray = [];
function split_source($str) {
$exp = explode(':', $str);
return $exp;
}
foreach ($source as $s) {
@ahmadshah
ahmadshah / componentA.vue
Created June 24, 2016 07:49
Vuejs Event Emitter
<template>
<button @click="emitEvent">EVENT</button>
</template>
<script>
import { EV } from './events'
export default {
methods: {
emitEvent() {