Skip to content

Instantly share code, notes, and snippets.

View metallurgical's full-sized avatar
🏖️
Whooppss

Norlihazmey Ghazali metallurgical

🏖️
Whooppss
View GitHub Profile
@metallurgical
metallurgical / Response.php
Created August 20, 2019 13:56 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@metallurgical
metallurgical / rm_mysql.md
Created October 4, 2018 16:35 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@metallurgical
metallurgical / bash_command
Created August 27, 2018 03:53
[Terminal - Command] Terminal(Bash) command #Command
Basic moves
==============
1. Move back one character. Ctrl + b
2. Move forward one character. Ctrl + f
3. Delete current character. Ctrl + d
4. Delete previous character. Backspace
5. Undo. Ctrl + -
Moving faster
==============
@metallurgical
metallurgical / PhpWord.HTML.php
Last active March 21, 2018 08:24 — forked from pankamilr/PhpWord.HTML.php
[Php - Phpoffice Override]Override PHPOffice\PHPWord class to generate docx file from HTML code. This one generate correct numbers when ordered list occur. #All #Script #Php
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
*
* PHPWord is free software distributed under the terms of the GNU Lesser
* General Public License version 3 as published by the Free Software Foundation.
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code. For the full list of
@metallurgical
metallurgical / LoginController.php
Last active March 21, 2018 07:53 — forked from SaeedPrez/LoginController.php
[Laravel - Custom error message] Laravel 5.4 Additional Login Conditions - Add custom error message. #All #Script #Laravel #Php
<?php
// This is code to return custom error message
// for Youtube tutorial: Laravel 5.4 Additional Login Conditions
// https://www.youtube.com/watch?v=Z8s6uhhD1Pk
namespace App\Http\Controllers\Auth;
@metallurgical
metallurgical / gist:bf163bf67b0235aabcf44f41d368af9a
Last active March 21, 2018 08:08 — forked from boushley/gist:5471599
[Javascript - Encode and decode] A JavaScript UTF-8 decoding function for ArrayBuffers. Credit for most of the heavy lifting goes to "bob" http://ciaranj.blogspot.com/2007/11/utf8-characters-encoding-in-javascript.html #All #Javascript #Script
function decodeUtf8(arrayBuffer) {
var result = "";
var i = 0;
var c = 0;
var c1 = 0;
var c2 = 0;
var data = new Uint8Array(arrayBuffer);
// If we have a BOM skip it
@metallurgical
metallurgical / README
Last active March 21, 2018 08:16 — forked from MarsVard/README
[Android - Drawable google card] android drawable to imitate google cards. #All #Android #Script
put card.xml in your drawables directory, put colors.xml in your values directory or add the colors to your colors.xml file.
set the background of a view to card,
as you can see in card.xml the drawable handles the card margin, so you don't have to add a margin to your view
``` xml
<View
android:layout_width="fill_parent"
@metallurgical
metallurgical / install-comodo-ssl-cert-for-nginx.rst
Last active March 21, 2018 08:17 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
[Nginx - Install comodo on nginx web server] Steps to install a Comodo PositiveSSL certificate with Nginx. #All #Server #Nginx #Script

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@metallurgical
metallurgical / ruby_rails_windows.md
Last active March 21, 2018 08:20 — forked from KelseyDH/ruby_rails_windows.md
[Ruby - Rails setup on windows] #All #Ruby #Rails #Tutorial

##Ruby on Rails Windows Troubleshooting Tips & Survival Guide

###Intro/Overview

The Ruby on Rails Windows Troubleshooting tips & Survival Guide is a random catalogue of issues I faced working with Ruby on Rails on Windows (Windows 7 specifically). This guide is not exhaustive, but covers many of the challenges that causes Windows Ruby developers to jump ship to Linux or Mac. If you're reading this guide then you're probably new to Ruby/Rails, so also included is more general beginner advice to help you get going.

####Personal Side Note

Before you follow this guide, I strongly recommend you consider using Linux or Mac OS X for Ruby Development instead. Reckless, and looking to prove a point; I ignored this strongly given advice while learning Ruby/Rails at a coding bootcamp. While I eventually did succeeed in getting Ruby on Rails to work in Windows, it was not easy, and I easily lost 40+ hours on StackOverFlow to Windows/Ruby configuration issues--time I could have devoted to lear