Skip to content

Instantly share code, notes, and snippets.

View nasrulhazim's full-sized avatar
🎯
Focusing

Nasrul Hazim Bin Mohamad nasrulhazim

🎯
Focusing
View GitHub Profile
@nasrulhazim
nasrulhazim / app.js
Created August 16, 2016 01:15
Laravel Delete Method using JavaScript
/*
Exemples :
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}">
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?">
*/
(function() {

Most active GitHub users in Malaysia

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Mon, 14 Apr 2014 04:55:12 GMT till Tue, 14 Apr 2015 04:55:12 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.location = 'malaysia')
@nasrulhazim
nasrulhazim / API.md
Created January 5, 2017 12:23 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@nasrulhazim
nasrulhazim / malaysia_holidays.json
Created January 6, 2017 06:59 — forked from alienxp03/malaysia_holidays.json
Malaysia 2017 Holidays (including states)
[
{
"name": "New Years Day",
"date": "01/01/2017",
"states": [
"Kuala Lumpur",
"Labuan",
"Malacca",
"Negeri Sembilan",
"Pahang",
@nasrulhazim
nasrulhazim / codeship-setup-commands-laravel-mysql.txt
Created January 4, 2018 16:06 — forked from nafiesl/codeship-setup-commands-laravel-mysql.txt
Codeship Setup Commands for Laravel that uses MySQL Database
phpenv local 7.0
echo "memory_limit = 512M" >> /home/rof/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# install dependencies
COMPOSER_HOME=${HOME}/cache/composer
composer install --prefer-dist --no-interaction
# set up environment variables
touch .env
echo "APP_ENV=testing" >> .env
echo "APP_DEBUG=true" >> .env
echo "APP_KEY=base64:sQPFP80eWJQGo0SDPc+M2Tib+GLUocRYRw4RLsfM27I=" >> .env
@nasrulhazim
nasrulhazim / README.md
Created February 15, 2018 05:27 — forked from claytonrcarter/README.md
Share named routes between Laravel and Javascript

Share named routes between Laravel and Javascript

This is a 2-part technique to share named routes between Laravel and Javascript. It uses a custom artisan command to export your named routes to JSON, and a Javascript route() helper to lookup the route and fill in any parameters. Written for Laravel 5.3; not tested in 5.4.

Installation

1. Install RouteJson.php

Copy RouteJson.php into your app as app/Console/Commands/RouteJson.php

@nasrulhazim
nasrulhazim / RouterServiceProvider.php
Created February 15, 2018 05:27 — forked from jeffochoa/RouterServiceProvider.php
Get collection of available routes in Laravel
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Route;
use Illuminate\Routing\Route as Router;
class RouterServiceProvider extends ServiceProvider
{
@nasrulhazim
nasrulhazim / macosx-install-php-oracle-oci8.md
Last active April 25, 2024 16:09 — forked from gido/macosx-install-php-oracle-oci8.md
install Oracle PHP Extension (oracle OCI8) - instantclient for Mac OS 10.12.6 - homebrew environnement - on PHP 7.2

Installation

This procedure is tested on Mac OS X 10.12.6

PHP 7.2 installed with Homebrew.

Preparation

Download the following files from Oracle website (yes, you need to create an account and accept terms):

@nasrulhazim
nasrulhazim / eloquent-cheatsheet.php
Created July 15, 2018 13:52 — forked from hassansin/eloquent-cheatsheet.php
Laravel 5 Eloquent CheatSheet #laravel #eloquent
Model::
/*Select*/
select('col1','col2')
->select(array('col1','col2'))
->select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_ratings, IFNULL(sum(reviews.score),0) as rating'))
->addSelect('col3','col4')
->distinct() // distinct select
/*From*/
@nasrulhazim
nasrulhazim / azure-pipelines.yml
Last active October 9, 2023 13:57 — forked from zanechua/azure-pipelines.yml
Azure Pipeline + Laravel + PHPUnit + Laravel Dusk
# PHP
# Test and package your PHP project.
# Add steps that run tests, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/php
trigger:
- develop
pool:
vmImage: 'Ubuntu-16.04'