Skip to content

Instantly share code, notes, and snippets.

View yashprit's full-sized avatar
💭
I may be slow to respond.

Yashprit yashprit

💭
I may be slow to respond.
View GitHub Profile
@yashprit
yashprit / jQuery_app_structure.js
Created May 30, 2014 06:31
This is one of way to Structure jQuery Application
(function(ctx, $, undefined){
$(document).ready(function(){
bindEvent();
})
function bindEvent () {
//private scope for application
}
@yashprit
yashprit / facade.js
Created May 30, 2014 06:49
facade implementation in JavaScript, Taken from Addy Osmani blog on design pattern
var plugin = (function() {
var _implementation = {
id: 5,
get: function () {
return this.id;
},
set: function (_id) {
id = _id;
},
run: function () {
@yashprit
yashprit / markdown_cheatsheet
Created June 2, 2014 06:49
List of GitHub Mark Down syntax
#Heading
~~~
# H1
## H2
### H3
#### H4
##### H5
###### H6
or
'use strict';
//npm install gulp gulp-minify-css gulp-uglify gulp-clean gulp-cleanhtml gulp-jshint gulp-strip-debug gulp-zip --save-dev
var gulp = require('gulp'),
clean = require('gulp-clean'),
cleanhtml = require('gulp-cleanhtml'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
stripdebug = require('gulp-strip-debug'),
var gulp = require('gulp');
var clean = require('gulp-clean');
var replace = require('gulp-replace');
var zip = require('gulp-zip');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
@yashprit
yashprit / Sublime_Shortcut.md
Last active August 29, 2015 14:02
Sublime Shortcut

Use Ctrl + P, its a GoTo Anything Popup:-

  1. Type, to search through files (open files, recently closed files, and files in open folders)

  2. @foo, to search through symbols in the current file

  3. :foo, to go to the given line number

  4. #foo, to do a fuzzy search in the current file for foo

@yashprit
yashprit / python_webserver.md
Last active August 29, 2015 14:02
Simple Python server on mac

You can open html file in browser, but browser open it with file:///, serving everything from file system is not possible, I mean working with ThreeJS, ploymer you need to run everything on web server. So here is very simple web server using Python on Mac

  1. Go to directory (your development) where you need to serve file using web server
  2. Type python -m SimpleHTTPServer 8000
  3. open in browser http://localhost:8000/<name_of_file>.html

You can see file serving from web server, instead of file:///

function foo(){
return Promise.all(["http://jsonplaceholder.typicode.com/posts/1", "http://jsonplaceholder.typicode.com/comments/1"]);
}
function task2(e){
alert("In two got " + e);
return " Two ";
}
function task3(e){
alert("In three got " + e);
return " Three ";
@yashprit
yashprit / shell_learning.sh
Last active August 29, 2015 14:03
Shell Learning, small utility
Using tr for separating words and then grep and wc seems possible :
tr -s ' ' '\n' < file.txt | grep file | wc -l
@yashprit
yashprit / process_monitor.sh
Created July 10, 2014 09:08
Monitor processing running on system, with single argument as process
#!/bin/bash
if [ $EUID != 0 ]
then
echo "Please run as root"
exit
fi
if [ "$1" == "" ]
then
echo "No process name provided"