Skip to content

Instantly share code, notes, and snippets.

View pankajpatel's full-sized avatar
🎯
Focusing

Pankaj Patel pankajpatel

🎯
Focusing
View GitHub Profile
@pankajpatel
pankajpatel / README.md
Created November 8, 2016 17:28 — forked from joyrexus/README.md
Form/file uploads with hapi.js

Demo of multipart form/file uploading with hapi.js.

Usage

npm install
npm run setup
npm run server

Then ...

@pankajpatel
pankajpatel / app.html
Last active October 2, 2016 19:54
ToDo with Edit Tasks; See live at https://jsbin.com/jahigec/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
@pankajpatel
pankajpatel / .bash_profile
Created September 3, 2016 12:25
bash_profile
alias c=clear
alias la="ls -al"
eval $(thefuck --alias)
# export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\W\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
@pankajpatel
pankajpatel / us-state-names-abbrevs.php
Created August 18, 2016 12:31 — forked from maxrice/us-state-names-abbrevs.php
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@pankajpatel
pankajpatel / StickierDiv.jsx
Created May 23, 2016 22:09 — forked from z5h/StickierDiv.jsx
sticky header div react js
/** @jsx React.DOM */
"use strict";
var util = {
// findPos() by quirksmode.org
// Finds the absolute position of an element on a page
findPos: function (obj) {
var curleft = 0,
curtop = 0;
//WelcomeApp: App Container, houses other components
//and creats underlying servicing methods
var WelcomeApp = React.createClass({
getInitialState: function(){
return { name: this.props.name };
},
handleKeyUp: function(newVal) {
this.setState( {name: newVal } );
},
render: function(){
@pankajpatel
pankajpatel / functions.php
Created March 14, 2016 23:38 — forked from mgibbs189/functions.php
FacetWP - sort by average rating using the WP Job Manager Reviews plugin
<?php
/**
* Add a "Rating" sort option
*
* @author David Nash <david@davidnash.com.au>
*/
function custom_wpjmr_after_save_comment_review( $comment_id ) {
$wpjmr = WP_Job_Manager_Reviews::instance();
$wpjmr->review->save_rating_average_post_meta( $comment_id );
}
@pankajpatel
pankajpatel / SampleComponent.js
Created March 9, 2016 21:39
React Component for Time to Hack
var CommentBox = React.createClass({
getInitialState: function(){
return { name: this.props.name };
},
handleKeyUp: function() {
this.setState( {name: this.refs.name.value } );
},
render: function(){
console.log( this.refs, this.state, this.props );
return (
@pankajpatel
pankajpatel / getOverlap.js
Last active January 15, 2021 12:36
Function to get the overlap between two elements
/**
* Provides the overlapping status between two elements
* based on the passed in Element objects
*
* @param {Element, Element} Element object of DOM
* @return {Boolean} overlap status or null if native object not received
*/
const isOverlapping = (e1, e2) => {
if (e1.length && e1.length > 1) {
e1 = e1[0];
@pankajpatel
pankajpatel / code-1.htm
Created February 21, 2016 12:14 — forked from bennadel/code-1.htm
Decoding Morse Code With JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Decoding Morse Code With JavaScript</title>
<style type="text/css">
div.output {}
div.output p.message {