Skip to content

Instantly share code, notes, and snippets.

@souparno
souparno / php mvc
Created August 1, 2014 13:43
php mvc
http://www.sitepoint.com/the-mvc-pattern-and-php-1/
http://www.sitepoint.com/the-mvc-pattern-and-php-2/
@souparno
souparno / cors.js
Created July 21, 2014 13:18 — forked from eriwen/cors.js
/**
* Make a X-Domain request to url and callback.
*
* @param url {String}
* @param method {String} HTTP verb ('GET', 'POST', 'DELETE', etc.)
* @param data {String} request body
* @param callback {Function} to callback on completion
* @param errback {Function} to callback on error
*/
function xdr(url, method, data, callback, errback) {
@souparno
souparno / javascript url
Created July 10, 2014 09:37
javascript url
JavaScript provides you many methods to retrieve and change the current URL which is displayed in browser's address bar. All these methods uses the Location object, which is a property of the Window object. You can create a new Location object that has the current URL as follows:
var currentLocation = window.location;
Basic Structure of a URL
<protocol>//<hostname>:<port>/<pathname><search><hash>
enter image description here
Protocol -- Specifies the protocol name be used to access the resource on the Internet. (HTTP (without SSL) or HTTPS (with SSL))
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Building a router</title>
<script>
// Put John's template engine code here...
(function () {
// A hash to store our routes:
@souparno
souparno / Toggling between nerdtree and edit
Created June 16, 2014 15:39
Toggling between nerdtree and edit
You can focus on a split window using # ctrl-ww.
for example, pressing:
1 ctrl-ww
would focus on the first window, usually being NERDTree.
@souparno
souparno / Function Encaptulation in php
Created April 24, 2014 00:14
Function Encaptulation in php
Encapsulation is just wrapping some data in an object. The term "encapsulation" is often used interchangeably with "information hiding". Wikipedia has a pretty through article.
Here's an example from the first link in a Google search for 'php encapsulation':
<?php
class App {
private static $_user;
@souparno
souparno / IIFE(IMIDIATELY INVOKED FUNCTIOIN EXPRESSION)
Created March 26, 2014 19:12
IIFE(IMIDIATELY INVOKED FUNCTIOIN EXPRESSION)
http://benalman.com/news/2010/11/immediately-invoked-function-expression/
@souparno
souparno / Git Command tutorial
Created March 15, 2014 09:33
Git Command tutorial
https://www.atlassian.com/git
@souparno
souparno / gist:9286665
Created March 1, 2014 07:50
creating virtual directory though pip for python
http://opentechschool.github.io/python-flask/core/setup.html
@souparno
souparno / Example of call and apply
Created January 31, 2014 20:57
Example of call and apply
Articles
Blog
About
Function.apply and Function.call in JavaScript
Thursday, July 5, 2007
24 comments
Tweet
In order to explain how the createDelegate function works in the last post, we have to understand JavaScript closures and Function.apply(). The apply() method is the easiest subject to tackle, so we'll start there and work up.