Skip to content

Instantly share code, notes, and snippets.

View ruslanashaari's full-sized avatar
🎯
Focusing

Ruslan Ashaari ruslanashaari

🎯
Focusing
  • Tata Consultancy Services
  • Kuala Lumpur
View GitHub Profile
@rained23
rained23 / gist:8932657
Created February 11, 2014 10:40
Malaysia States Array
$states = [
'JHR' => 'Johor',
'KDH' => 'Kedah',
'KTN' => 'Kelantan',
'MLK' => 'Melaka',
'NSN' => 'Negeri Sembilan',
'PHG' => 'Pahang',
'PRK' => 'Perak',
'PLS' => 'Perlis',
'PNG' => 'Pulau Pinang',
@dahjelle
dahjelle / Array Exercises (PHP).markdown
Last active November 5, 2023 05:17
Array Exercises (PHP)

Array Exercises (PHP)

Questions

  1. If you have an array $a = array( 0, 1, 2, 3, 4 );, how do you extract the value 3 from the array?

  2. If you have an array $a = array( "zero"=>0, "one"=>1, "two"=>2, "three"=>3, "four"=>4 );, how do you extract the value 3 from the array?

  3. If you have the following array, how do you extract the value 3 from the array?

@raelgc
raelgc / Install MSOffice on Ubuntu.md
Last active February 26, 2024 03:10
Install MSOffice on Ubuntu

Install Microsoft Office 2010 on Ubuntu

Requirements

We'll install MSOffice using the PlayOnLinux wizard. Additionally, MSOffice requires samba and winbind to properly work.

So, if not installed, install them:

sudo apt-get install playonlinux samba winbind
@tsudot
tsudot / plivo_curl.php
Last active November 21, 2021 10:22
Send an SMS using curl through Plivo.
<?php
# Plivo AUTH ID
$AUTH_ID = '';
# Plivo AUTH TOKEN
$AUTH_TOKEN = '';
# SMS sender ID.
$src = '';
@robertopc
robertopc / adminer.css
Last active April 2, 2023 14:16
Adminer Black Custom Theme
/** theme "easy on the eyes" for Adminer by [email protected] */
/** customized by RobertoPC in https://gist.github.com/robertopc/bf2edac131bbaf789343fa9ce3ceb2e4 **/
@import url(//fonts.googleapis.com/css?family=Roboto+Mono:400,900);
/* for font awesome */
*:not(.fa) {
font-family: 'Roboto Mono', sans-serif;
}
@nasrulhazim
nasrulhazim / dry_n_skinny.md
Created February 17, 2017 01:37
Dry & Skinny Laravel Application

Dry & Skinny

  1. Fat Model & Skinny Controller

  2. Bus / Job Pattern

    • Command Bus > Jobs
      • A task take a small unit of work
      • NOT return a value
    • Further reading: CRUD & CQRS
    • Reusable, Skinny Controller as more reusable codes move to Job
@bgarrant
bgarrant / ValetSwitchPHP.md
Last active September 30, 2022 08:08
How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

Valet switch PHP version with these commands

Install PHP 5.6 and switch Valet to PHP 5.6

valet stop
brew unlink php71
brew install php56
brew install php56-mcrypt
<?php
$results = $this->model->get(array('id','column1','column2','column3', 'etc'));
$fileName = 'my-export-'.Carbon::now()->timestamp;
$export = $this->excel->create($fileName, function($excel) use ($results) {
$excel->setTitle('Our new awesome title')
->setCreator('Maatwebsite')
->setCompany('Maatwebsite')
@Zemnmez
Zemnmez / tweetdeck-limit-override-dm-rt-fix.js
Last active March 13, 2023 15:21
tweetdeck-limit-override.js
/*
This snippet is esssentially the same as being in the Twitter longer tweets test, for tweetdeck.
The Tweet length counter is fixed by tricking TweetDeck into counting up to 140 characters, twice, so you'll see 140
instead of 280 in the counter but going over 140 will give you another set of 140 charactrs.
*/
TD.services.TwitterClient.prototype.makeTwitterCall=function(b,e,f,g,c,d,h){c=c||function(){};d=d||function(){};b=this.request(b,{method:f,params:Object.assign(e,{weighted_character_count:!0}),processor:g,feedType:h});return b.addCallbacks(function(a){c(a.data)},function(a){d(a.req,"",a.msg,a.req.errors)}),b};
twttrTxt=Object.assign({},twttr.txt,{isInvalidTweet:function(){return!1},getTweetLength:function(x){return x=twttr.txt.getTweetLength.apply(this,arguments),x<140||x/140>2?x:x%140}});
@brnpimentel
brnpimentel / beautify-html.js
Created December 18, 2017 13:37
JS Beautify hack to works with blade directives (laravel)
function style_html(html_source, options, js_beautify, css_beautify) {
html_source = html_source.replace(/\@([^\n\s]*)/ig, "<blade $1/>");
...
sweet_code = sweet_code.replace(/<blade ([^\n]*)\/>/ig, "@$1");
sweet_code = sweet_code.replace(/\(\ \'/ig, "('");
...