This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$base-font-size: 18px; | |
// Convert PX to EM | |
@function em($px, $bfs: $base-font-size){ | |
@return ($px / $bfs) + 0em; | |
} | |
// Usage: | |
body { | |
font-size: em(24px); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get the path of php.ini in command line | |
php --ini | |
// get the current memory limit | |
php -r "echo ini_get('memory_limit').PHP_EOL;" | |
// Temporary change memory limit for composer | |
php -d memory_limit = 1024M composer.phar | |
// Get the current permission of file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validateNationalNumber(value) { | |
if (value == '0000000000' || | |
value == '1111111111' || | |
value == '2222222222' || | |
value == '3333333333' || | |
value == '4444444444' || | |
value == '5555555555' || | |
value == '6666666666' || | |
value == '7777777777' || | |
value == '8888888888' || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://download.redis.io/redis-stable.tar.gz | |
tar xzvf redis-stable.tar.gz | |
cd redis-stable/deps | |
make hiredis jemalloc linenoise lua | |
cd .. | |
make install | |
sysctl vm.overcommit_memory=1 | |
sysctl -w fs.file-max=100000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Based on the original source of Nick Stamas @nickstamas https://github.com/nickstamas/Sketch-Quick-Pic | |
//Modified by @timur_carpeev | |
//Latest modification by @_alirezas | |
if ([selection count] > 0) { | |
var request = [[NSMutableURLRequest alloc] init]; | |
[request setHTTPMethod:@"GET"]; | |
var queryString = "http://uifaces.com/api/v1/random"; | |
[request setURL:[NSURL URLWithString:queryString]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name RTL Slack | |
// @namespace slask.com | |
// @include https://*.slack.com/* | |
// @version 1.2.2 | |
// @grant none | |
// ==/UserScript== | |
function isRTL(text) { | |
if (text !== "") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var deadline = '2017-03-15'; | |
function getTimeRemaining(endtime){ | |
var t = Date.parse(endtime) - Date.parse(new Date()); | |
var seconds = Math.floor( (t/1000) % 60 ); | |
var minutes = Math.floor( (t/1000/60) % 60 ); | |
var hours = Math.floor( (t/(1000*60*60)) % 24 ); | |
var days = Math.floor( t/(1000*60*60*24) ); | |
return { | |
'total': t, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.toPersianDigit = function (latinDigit) { | |
return this.replace(/\d+/g, function (digit) { | |
var enDigitArr = [], peDigitArr = [], i, j; | |
for (i = 0; i < digit.length; i += 1) { | |
enDigitArr.push(digit.charCodeAt(i)); | |
} | |
for (j = 0; j < enDigitArr.length; j += 1) { | |
peDigitArr.push(String.fromCharCode(enDigitArr[j] + ((!!latinDigit && latinDigit === true) ? 1584 : 1728))); | |
} | |
return peDigitArr.join(''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fadeOut(el){ | |
el.style.opacity = 1; | |
(function fade() { | |
if ((el.style.opacity -= .1) < 0) { | |
el.style.display = "none"; | |
} else { | |
requestAnimationFrame(fade); | |
} | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
path = os.chdir('DIRECTORY_PATH') | |
files = os.listdir(path) | |
for file in files: | |
os.rename(file, file.lower()) |
OlderNewer