Skip to content

Instantly share code, notes, and snippets.

ahmadhasyim lordhasyim

Block or report user

Report or block lordhasyim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lordhasyim /
Created Oct 17, 2019 — forked from frfahim/
Install fish shell and oh-my-fish on ubuntu

First install fish shell on your system

sudo apt-get update
sudo apt-get install fish

Or install fish via ppa

sudo apt-add-repository ppa:fish-shell/release-2
sudo apt-get update
sudo apt-get install fish``
lordhasyim / gist:5c0baa1b9b89a00009093988836b1781
Created Aug 4, 2019 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:5c0baa1b9b89a00009093988836b1781


:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
lordhasyim /
Created Aug 4, 2019 — forked from Kartones/
PostgreSQL command line cheatsheet


Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
View gist:4054ab6ac5567d9e4c615f9533808b19
Run this
"sudo -u postgres psql"
in your terminal to get into postgres
Run "CREATE USER new_username;"
Note: Replace new_username with the user you want to create,
lordhasyim / User.php
Created Jul 24, 2019 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
View User.php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
* @ORM\Entity()
* @ORM\Table(name="user")
class User
lordhasyim / .htaccess
Created Jul 23, 2019 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
View .htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php
#Redirect an entire site:
Redirect 301 /
#Redirect an entire site to a sub folder
Redirect 301 /
lordhasyim / .htaccess
Created Jul 23, 2019 — forked from heiswayi/.htaccess
Common .htaccess Redirects
View .htaccess
# 301 Redirects for .htaccess
# ===========================
# Redirect a single page:
Redirect 301 /pagename.php
# Redirect an entire site:
Redirect 301 /
# Redirect an entire site to a subfolder
lordhasyim / paragraphFunction.php
Created Jun 18, 2019 — forked from a9un9hari/paragraphFunction.php
PHP get first paragraph from a string function
View paragraphFunction.php
function getFirstPara($string){
$string = substr($string,0, strpos($string, "</p>")+4);
return $string;
// If you wanted to remove the paragraph tags from the HTML
function getFirstPara2($string){
$string = substr($string,0, strpos($string, "</p>")+4);
$string = str_replace("<p>", "", str_replace("<p/>", "", $string));
lordhasyim / viewport-tracking.js
Created May 14, 2019 — forked from taylor-rowe/viewport-tracking.js
A simple script to track viewport size and orientation on page load or when either changes
View viewport-tracking.js
(function() {
//first we will find the current width and height and declare a few variables that we'll use later
var vW = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
var vH = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var orientation = null;
var viewRange = null;
//enter the pixel values that trigger your responsive design
var breakpoints = [480, 992, 1200];
lordhasyim / isElementInViewport.js
Last active May 12, 2019 — forked from davidtheclark/isElementInViewport.js
JavaScript: Is element in viewport?
View isElementInViewport.js
No jQuery necessary.
Thanks to Dan's StackOverflow answer for this:
function isOneHundredPercentOfElementInViewport(el) {
var rect = el.getBoundingClientRect();
return ( >= 0 &&
You can’t perform that action at this time.