Skip to content

Instantly share code, notes, and snippets.

View samarpanda's full-sized avatar
👋

Samar Panda samarpanda

👋
View GitHub Profile
@samarpanda
samarpanda / Previous.twig
Created November 18, 2012 10:20
Updated & Previous file
<icons>
{% for icon in icons %}
{% set iconObj = icon['iconObj'] %}
<icon id="{{iconObj.Slug}}{{loop.index}}" title="{{iconObj.DisplayName}}">
<title><![CDATA[{{icon['big_title']}}]]></title>
<subtitle><![CDATA[{{icon['small_title']}}]]></subtitle>
<greencopy><![CDATA[{{icon['green_desc']|raw}}]]></greencopy>
<copy1><![CDATA[{{icon['long_desc']|raw}}]]></copy1>
{% set gallery = icon['imgGallery'] %}
{% if gallery and gallery.images|length > 0 %}
@samarpanda
samarpanda / SimpleStructure.js
Last active October 12, 2015 23:48
Module reveal pattern.
(function(undefined){
"use strict"
if(jQuery === undefined)
return;
var $ = window.jQuery;
var sBASE = function(){
var self,
/**
* Cache all dom nodes to below config object. To prevent unecessary multiple dom traverse using jQuery(As i am using jQuery here.).
*/
@samarpanda
samarpanda / gist:4125105
Last active December 1, 2023 08:20
Test your php code execution time and Memory usage
<?php
// from http://php.net/manual/en/function.filesize.php
function formatBytes($bytes, $precision = 2) {
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
@samarpanda
samarpanda / gist:4132317
Last active October 13, 2015 03:28
Git help commands to retrieve branch file changes

Git commands to retrieve branch add/Edit file changes

Modified Files

 git diff HASH_KEY --name-only --diff-filter=[M]

Added files

@samarpanda
samarpanda / fiddle.css
Created November 28, 2012 19:01 — forked from zalun/fiddle.css
body {
font-family: Helvetica, Verdana
}
p {
padding: 7px 10px;
}
#demo {
border: 1px solid #999;
}
require(
[
jquery,
lodash,
backbone
],
function($, _, Backbone){
});
@samarpanda
samarpanda / gist:4252771
Created December 10, 2012 19:33
Elegant way of checking parameter types in Javascript
function something(param1, param2, param3, param4){
// args contains all the parameters as array
// i.e args[0] == param1, args[1] == param2 and so on
var args = Array.prototype.slice.call(arguments);
}
//To check if a variable is of type Sting
var str = "Samar",
bool = false;
@samarpanda
samarpanda / gist:4293769
Created December 15, 2012 10:56
Git autocomplete for Mac By webdizz
@samarpanda
samarpanda / Sublime Text 2 keyboard shortcut.md
Last active January 26, 2023 16:02
My favorite keyboard shortcuts Sublime Text 2

Keyboard shortcuts for Sublime Text 2

  1. Multi-selection: To enable multi-selection, you have several options
  • Press Alt or Command and then click in each region where you require a cursor.
  • Select a block of line, and then press Shit + Command + L
  • Place the cursor over a particular word, and press Control/Command + D repeatedly to select additional occurences of that word.
  • Alternatively, add an additional cursor at all occurences of a word by typing Alt+F3 on Windows, or Ctrl+Command+G on the Mac.
  1. Find all occurence of a word in a file and edit all of those at a time: > Command + F then Option + Enter. All the occurance of the word should be editable.
@samarpanda
samarpanda / UploadFileToServer.md
Last active December 10, 2015 17:38
Upload image to server and copy the link to clipboard using bash!

Bash tips

Copy these functions to .bash_profile or .bashrc

Upload file to server using curl

function curlp(){
  curl -u username:password -T $1 ftp://domain.com/dir/$1;
	echo "http://domain.com/dir/$1" | pbcopy;