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 / blockchain.go
Created June 21, 2023 12:28 — forked from LordGhostX/blockchain.go
Blockchain POC with Golang
package main
import (
"crypto/sha256"
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
)
@nasrulhazim
nasrulhazim / gist:bd6483b8355fbcaea15e2a0ffd89b882
Created April 5, 2022 18:27 — forked from metaskills/gist:893599
A Copy Of sp_MSforeachtable Stored Procedure For Azure, Uses sp_MSforeach_worker
CREATE proc [dbo].[sp_MSforeachtable]
@command1 nvarchar(2000), @replacechar nchar(1) = N'?', @command2 nvarchar(2000) = null,
@command3 nvarchar(2000) = null, @whereand nvarchar(2000) = null,
@precommand nvarchar(2000) = null, @postcommand nvarchar(2000) = null
AS
declare @mscat nvarchar(12)
select @mscat = ltrim(str(convert(int, 0x0002)))
if (@precommand is not null)
exec(@precommand)
@nasrulhazim
nasrulhazim / .php_cs
Created July 6, 2019 11:57 — forked from jwage/.php_cs
php-cs-fixer git pre commit hook
<?php
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers([
'short_array_syntax',
'ordered_use',
])
;
@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'
@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 / 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 / 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 / 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 / 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 / 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",