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
lordhasyim / oh-my-fish.md
Created Oct 17, 2019 — forked from frfahim/oh-my-fish.md
Install fish shell and oh-my-fish on ubuntu
View oh-my-fish.md

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
lordhasyim / gist:5c0baa1b9b89a00009093988836b1781
Created Aug 4, 2019 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:5c0baa1b9b89a00009093988836b1781

People

: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
lordhasyim / postgres-cheatsheet.md
Created Aug 4, 2019 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet
View postgres-cheatsheet.md

PSQL

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
postgres=#
Run "CREATE USER new_username;"
Note: Replace new_username with the user you want to create,
@lordhasyim
lordhasyim / User.php
Created Jul 24, 2019 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
View User.php
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@lordhasyim
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 http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@lordhasyim
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 http://www.domain.com/pagename.html
# Redirect an entire site:
Redirect 301 / http://www.domain.com/
# Redirect an entire site to a subfolder
@lordhasyim
lordhasyim / paragraphFunction.php
Created Jun 18, 2019 — forked from a9un9hari/paragraphFunction.php
PHP get first paragraph from a string function
View paragraphFunction.php
<?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
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
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:
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
*/
function isOneHundredPercentOfElementInViewport(el) {
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
You can’t perform that action at this time.