Skip to content

Instantly share code, notes, and snippets.

@faisalhmohd
faisalhmohd / tagextract.js
Created September 22, 2016 05:38
Extract required HTML tag from string
var thehtmlstring =
'<h1 id="theid">headingone</h1>' +
'<p class="comments-section">'+
'thetext' +
'<div class="thediv">' +
'<div class="theinnerdiv">theinnerdivtext</div>' +
'</div>' +
'</p>';
function extractTag(string, tag){
@faisalhmohd
faisalhmohd / tagged.js
Last active October 12, 2016 15:40
Tumblr call tagged posts
function getRSSUrl(tag){
return '/tagged/'+ tag +'/rss'
}
var rssurl = getRSSUrl('featured');
$.get(rssurl, function(data) {
// Append to divs
});
@faisalhmohd
faisalhmohd / location.js
Created September 20, 2016 04:22
Get location of current page
function getLocation(){
return window.location.pathname;
}
var currentLocation = getLocation();
@faisalhmohd
faisalhmohd / installnodejs.sh
Created August 27, 2016 03:20
Installing NodeJS using N
apt-get install -y npm
npm install -g n
# Get NodeJS stable. Use 'n latest' for latest build
n stable
# Remove existing NodeJS symbolic link (optional)
rm -r /usr/bin/node
# Replace existing symbolic link
@faisalhmohd
faisalhmohd / atom.sh
Created July 30, 2016 15:23
Ubuntu Installations
sudo add-apt-repository ppa:webupd8team/atom
sudo apt-get update
sudo apt-get install atom
@faisalhmohd
faisalhmohd / index.php
Last active July 19, 2016 14:30
Page Links on WordPress for Dynamic use
<?php $ID = 0; // Page ID to refer ?>
<a href="<?php echo get_page_link($ID); ?>">Page Name</a>
@faisalhmohd
faisalhmohd / keybase.md
Created July 12, 2016 07:16
My Keybase verification

Keybase proof

I hereby claim:

  • I am faisalhmohd on github.
  • I am mohdfaisal (https://keybase.io/mohdfaisal) on keybase.
  • I have a public key whose fingerprint is 042A A11E D2D7 BE9B FA2B B210 3E79 35BE C478 2F82

To claim this, I am signing this object:

@faisalhmohd
faisalhmohd / Dockerfile
Last active July 28, 2016 17:53
Dockerfile for NodeJS development
# Running on ubuntu:latest
FROM ubuntu
# Update and install NodeJS + NPM
RUN apt-get update
RUN apt-get install -y nodejs npm
# Creating symlink
RUN ln -s /usr/bin/nodejs /usr/bin/node
@faisalhmohd
faisalhmohd / index.php
Created June 26, 2016 17:47
[Wordpress] Infinte loop on all posts page
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$perpage = 5;
$args = array (
'pagination' => true,
'posts_per_page' => $perpage,
'post_type' => 'post',
'paged' => $paged
);
@faisalhmohd
faisalhmohd / page-thepage.php
Last active June 26, 2016 12:50
[Wordpress] Infinite Loop of Posts on Custom Static Page
<?php
$paged = $_GET['paged'];
$perpage = 15; // Choose the number of posts per loop
$args = array (
'pagination' => true,
'posts_per_page' => $perpage,
'post_type' => 'post',
'offset' => $paged*$perpage
);