Skip to content

Instantly share code, notes, and snippets.

View fizerkhan's full-sized avatar

Fizer Khan (பைசர் கான்) fizerkhan

View GitHub Profile
// PDO Connection to MySQL
$conn = new PDO('mysql:host=localhost;dbname=yourdbname', 'username', 'password');
// PDO Connection to PostgreSQL
$conn = new PDO('pgsql:host=localhost;dbname=yourdbname', 'username', 'password');
// A quick Select Query with For Loop
foreach ($conn->query("SELECT * FROM profile") as $row)
echo $row['fullname'];
@fizerkhan
fizerkhan / FeedlyCenteredSlider.user.js
Created March 16, 2017 11:58 — forked from TheBronx/FeedlyCenteredSlider.user.js
Centers the new slider on Feedly
// ==UserScript==
// @name Feedly Centered Slider
// @namespace http://salvatorelab.es
// @version 2.0
// @description Centers the slider on Feedly
// @match http://feedly.com/*
// @grant GM_addStyle
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
// ==/UserScript==
@fizerkhan
fizerkhan / index.js
Last active January 5, 2017 17:25
AtatusJS Redux Middleware
// Add atatus middlware to your redux store
import atatusMiddleware from './redux-atatus-middleware';
createStore(
rootReducer,
initialState,
applyMiddleware(atatusMiddleware())
);
# -*- coding: utf-8 -*-
import itertools
import re
import urlparse
import boto
import warc
from boto.s3.key import Key
from gzipstream import GzipStreamFile
@fizerkhan
fizerkhan / alexa.js
Created November 27, 2016 09:55 — forked from chilts/alexa.js
Getting the Alexa top 1 million sites directly from the server, unzipping it, parsing the csv and getting each line as an array.
var request = require('request');
var unzip = require('unzip');
var csv2 = require('csv2');
request.get('http://s3.amazonaws.com/alexa-static/top-1m.csv.zip')
.pipe(unzip.Parse())
.on('entry', function (entry) {
entry.pipe(csv2()).on('data', console.log);
})
;
@fizerkhan
fizerkhan / sourcemap-checker.js
Last active October 31, 2016 11:41
Validate and get actual line number of the stacktrace using source map
//
// Purpose:
//
// To validate the source map
// To get actual line number of the stack trace
//
// Usage:
// You need to do following
//
// 1. Copy the source map to the directory where you have this script.
@fizerkhan
fizerkhan / keybase.md
Created July 16, 2016 07:11
keybase.md

Keybase proof

I hereby claim:

  • I am fizerkhan on github.
  • I am fizerkhan (https://keybase.io/fizerkhan) on keybase.
  • I have a public key whose fingerprint is FC70 6E02 CFA6 C972 4445 A535 D8C5 19A3 CCA5 DA5D

To claim this, I am signing this object:

(function() {
"use strict";
angular
.module( appName, [ ] )
.config([ "$provide", function( $provide )
{
// Use the `decorator` solution to substitute or attach behaviors to
// original service instance;
@fizerkhan
fizerkhan / nginx.conf
Created February 4, 2016 08:35 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@fizerkhan
fizerkhan / gist:7837764
Last active December 30, 2015 13:49
Pipe input Stream to S3
var fs = require('fs')
, amazonS3 = require('awssum-amazon-s3');
// Create S3 Object
var s3 = new amazonS3.S3({
'accessKeyId' : 'YOUR_ACCESS_KEY',
'secretAccessKey' : 'YOUR_SECRET_ACCESS_KEY',
'region' : amazonS3.US_EAST_1
});