Skip to content

Instantly share code, notes, and snippets.

View Bersam's full-sized avatar
🎯
Focusing

bersam Bersam

🎯
Focusing
View GitHub Profile
@Bersam
Bersam / 2048.js
Last active August 29, 2015 13:57
function getGridString(grid){
var a = "";
for(var i=0; i<=3; i++){
for(var j=0; j<=3; j++){
if(grid[j][i]){
a += grid[j][i].value.toString();
} else {
a += "0";
}
}
@Bersam
Bersam / ofest-ir.js
Last active August 29, 2015 14:01
How to force register after registering was closed in #Ofest
// var content= content1_value +'<br>'+ content3_value + '<br>' + content4_value + '<br>' + content5_value + '<br>' + content6_value ;
var content= "VIP Person"
var email="me@example.com"
var name="DJ Hossein Fasanghari"
$.post("http://ofest.ir/site/registerorder", { 'name': name , 'email': email , 'content': content }, function (data) {
console.log("Done");
});
@Bersam
Bersam / toPersianNumber.js
Created July 6, 2014 08:21
toPersianNumber function
function toPersianNumber(value) {
if (!value) {
return;
}
var arabicNumbers = ["١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩", "٠"],
persianNumbers = ["۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹", "۰"];
for (var i = 0, numbersLen = arabicNumbers.length; i < numbersLen; i++) {
value = value.replace(new RegExp(arabicNumbers[i], "g"), persianNumbers[i]);
}
@Bersam
Bersam / allmyles.py
Last active August 29, 2015 14:12
Allmyles Sample For Python2
import requests, json
api_key = "12345678-1234"
api_url = "http://somewhere.com"
data = json.dumps({
'fromLocation': 'BUD',
'toLocation': 'LON',
'departureDate': '2014-12-29T00:00:00Z',
'resultTypes': 'default',
@Bersam
Bersam / bower.json
Last active August 29, 2015 14:18
bower.json sample with override FlexSlider main property
{
"name": "bersam",
"homepage": "http://bersam.org",
"authors": [
"Bersam Karbasion <bersam@bersam.org>"
],
"license": "MIT",
"private": true,
"dependencies": {
"modernizr": "2.8.2",
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration."
(setq-default
;; List of additional paths where to look for configuration layers.
;; Paths must have a trailing slash (ie. `~/.mycontribs/')
dotspacemacs-configuration-layer-path '()
@Bersam
Bersam / biditex-Sample.tex
Last active December 26, 2015 16:12
Sample Tex File With Full Bidi Support (Including Numbers)
\documentclass{article}
\usepackage{xepersian}
\makeatletter
% classes 1-3 are used in unicode-letters.tex, so we'll put the Latin letters in 4
\newcount\xp@n
\xp@n=`\A \loop \XeTeXcharclass \xp@n=4 \ifnum\xp@n<`\Z \advance\xp@n by 1 \repeat
\xp@n=`\a \loop \XeTeXcharclass \xp@n=4 \ifnum\xp@n<`\z \advance\xp@n by 1 \repeat
% this line would put Latin numbers in 4 class too.
\xp@n=`\0 \loop \XeTeXcharclass \xp@n=4 \ifnum\xp@n<`\9 \advance\xp@n by 1 \repeat
% when we encounter class 4, we'll do \startlatin
http://rami.ir/fa/wp-content/uploads/2010/11/Avarah.mp3
http://rami.ir/fa/wp-content/uploads/2010/11/Asir-1.mp3
http://rami.ir/fa/wp-content/uploads/2011/12/Onroozo.mp3
http://rami.ir/fa/wp-content/uploads/2010/11/Baron-baraku.mp3
http://rami.ir/fa/wp-content/uploads/2010/11/Bad-omkeh-1.mp3
http://rami.ir/fa/wp-content/uploads/2010/11/Berkeye-khoshk.mp3
http://rami.ir/fa/wp-content/uploads/2010/11/Bolbol-1.mp3
http://rami.ir/fa/wp-content/uploads/2010/11/Bodow-bodow-1.mp3
http://rami.ir/fa/wp-content/uploads/2010/11/Bikasi-1.mp3
http://rami.ir/fa/wp-content/uploads/2010/11/Tanhayi.mp3

Keybase proof

I hereby claim:

  • I am bersam on github.
  • I am bersam (https://keybase.io/bersam) on keybase.
  • I have a public key whose fingerprint is 2B67 3DAD 18E6 3BEC 2D85 93C1 C297 5D58 FD1A 97F3

To claim this, I am signing this object:

var clean = function(self){
return self.pause()
.then(function() {
log.info(self.data.username + " is paused.");
self.toFollow.on('cleaned', function(job, type) {
console.log('Cleaned %s %s jobs', job.length, type);
});
return self.toFollow.clean(0, 'completed');
})
.then(function() {