Skip to content

Instantly share code, notes, and snippets.

View smohadjer's full-sized avatar

Saeid Mohadjer smohadjer

View GitHub Profile
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@cmalven
cmalven / index.html
Last active April 10, 2024 01:23
Shortest (useful) HTML5 Document
<!-- http://www.brucelawson.co.uk/2010/a-minimal-html5-document/ -->
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>blah</title>
</head>
<body>
<p>I'm the content</p>
@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@localpcguy
localpcguy / swipeFunc.js
Created November 17, 2011 16:00
Simple Mobile Swipe function to get the swipe direction
var swipeFunc = {
touches : {
"touchstart": {"x":-1, "y":-1},
"touchmove" : {"x":-1, "y":-1},
"touchend" : false,
"direction" : "undetermined"
},
touchHandler: function(event) {
var touch;
if (typeof event !== 'undefined'){
var gulp = require('gulp');
var connect = require('gulp-connect');
var cors = function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Headers', '*');
next();
};
gulp.task('server:test', function () {
@chrisjacob
chrisjacob / charCode-encode-string.js
Created June 1, 2010 17:41
string2charCodeString encodes the entire string to charCode values. idEncode converts a string into a valid HTML id attribute [A-Za-z0-9_-]. Useful for producing readable window.location.hash fragments
// Example:
// http://github.com/chris/project123/blob/master/new_mailer/install-file.rb
// 104-116-116-112-58-47-47-103-105-116-104-117-98-46-99-111-109-47-99-104-114-105-115-47-112-114-111-106-101-99-116-49-50-51-47-98-108-111-98-47-109-97-115-116-101-114-47-110-101-119-95-109-97-105-108-101-114-47-105-110-115-116-97-108-108-45-102-105-108-101-46-114-98
function string2charCodeString (s){
if(typeof(s) != 'string') return false;
a = [];
f = s.length;
for (i = 0; i<f; i++) {
a[i] = s.charCodeAt(i);