Skip to content

Instantly share code, notes, and snippets.

View jsartisan's full-sized avatar
🧩

Pawan Kumar jsartisan

🧩
View GitHub Profile
var users = (function(){
var actions = {
onClickSomeButton: function(e){
console.log('button clicked');
},
onKeyupSomeInput: function(e){
console.log('key is pressed');
}
};
# init.js
require('./users').init();
require('./categories').init();
require('./posts').init();
require('./comments').init();
var users = (function(){
var actions = {
};
var form = {
};
var myNamespace = (function () {
var myPrivateVar, myPrivateMethod;
// A private counter variable
myPrivateVar = 0;
// A private function which logs any arguments
myPrivateMethod = function( foo ) {
console.log( foo );
@jsartisan
jsartisan / maintaining-js-code-1.js
Last active November 6, 2017 07:36
Maintaining Javascript Code
$('.some-button').click(function(){
 console.log('clicked a button'); 
 });
$('.another-button').click(function(){
 console.log('clicked another button'); 
});
@jsartisan
jsartisan / webpack.config.js
Created August 2, 2017 02:28
My Webpack file for Jquery based projects
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
var ManifestPlugin = require('webpack-manifest-plugin');
var env = process.env.NODE_ENV ? process.env.NODE_ENV : 'dev';
// outfile name based on enviroment
var outfile_name = env == "dev" ? "[name]" : "[name]-[hash]";
• curl - Making HTTP requests
• wget - Retrieve files from the web
• unzip - Unzip zip files
• git - Git version control
• ack - An advanced search tool for searching content of files
• htop - Interactive process viewer (better than the simple “top”)
• vim - The timeless editor. Pro-Tip: Hit “esc” then type “:q” then hit “Enter” to quit. Now you
know.
• tmux - Terminal Multiplexor - Basically, split your terminal session into different panes
• software-properties-common - This is specific to Ubuntu. We’ll use it to add software
@jsartisan
jsartisan / .sh
Created July 30, 2016 18:11
Useful Bash Commands
# checking network configuration
ifconfig
# Print working directory. The “working directory” is the directory you are current in
pwd
# List contents of current working directory
ls
# List contents in a list form, with extra information:
@jsartisan
jsartisan / vagrant.sh
Last active July 30, 2016 17:59
Vagrants Commands
// create a VagrantFile
vagrant init ubuntu/trusty64
// Download the Box specified in the Vagrant File and setup the box
vagrant up
// ssh into the vagrant box
vagrant ssh
// tell about the running vagrant boxes
@jsartisan
jsartisan / .htaccess
Last active July 14, 2016 04:13
Leveraging Browser Caching with .htaccess
## First you have to enable mod_expires ( sudo a2enmod expires )
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"