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
# Prerender kurulumu | |
sudo locale-gen UTF-8 | |
sudo apt-get update | |
sudo apt-get install -y curl | |
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - | |
sudo apt-get install -y nodejs build-essential libfontconfig nginx-extras | |
sudo npm install -g phantomjs | |
sudo npm install -g prerender | |
sudo npm install -g pm2 |
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 date1 = new Date(2010, 6, 17); | |
var date2 = new Date(2013, 12, 18); | |
var diff = new Date(date2.getTime() - date1.getTime()); | |
// diff is: Thu Jul 05 1973 04:00:00 GMT+0300 (EEST) | |
console.log(diff.getUTCFullYear() - 1970); // Gives difference as year | |
// 3 | |
console.log(diff.getUTCMonth()); // Gives month count of difference | |
// 6 |
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 fs = require('fs'); | |
module.exports = function (urlRoot, pathRoot) { | |
pathRoot = pathRoot.replace(urlRoot, ''); | |
return function(req, res, next){ | |
if (req.url.indexOf(urlRoot) === 0) { | |
// Ignore querystrings | |
url = req.url.split('?')[0]; |
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
<div synaps-secim></div> |
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
SearchQuerySet().filter(user__iexact="murat").filter(content__startswith=request.GET.get('q'))[:10] |
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
/** | |
* Load disqus comments when visitor scroll down page to comments | |
* | |
* Usage: | |
* Add a div with id "disqus_thread" and data attributes for every disqus parameter: | |
* | |
* <div id="disqus_thread" data-disqus-shortname="username" data-disqus-url="http://example.com/post/post-name/"></div> | |
* | |
* @author: Murat Corlu | |
* @link: https://gist.github.com/gists/2290198 |
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
#!/usr/bin python | |
""" | |
requires simplejson module (https://github.com/simplejson/simplejson) | |
Usage example: | |
tail -f /var/log/json.log | grep "muratcorlu.com" | python json.py log.date log.url | |
"2011.12.14 14:21" "http://muratcorlu.com/post/archieve/" | |
"2011.12.14 14:29" "http://muratcorlu.com/" |
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
/* | |
* Flash runs fireFlashEvent function with a event name parameter and | |
* several optional parameters. Javascript can listen these events by | |
* binding with addFlashEventListener function. | |
* | |
* Requires jQuery | |
*/ | |
// Global Document object for caching $(document) selector | |
Document = null; |
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 timer = { | |
started: 0, | |
end: 0, | |
now: function(){ return new Date(); }, | |
start: function(){ return this.started = this.now(); }, | |
since: function(){ this.end = this.now(); return this.now()-this.started; } | |
} | |
// Usage: |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="tr" lang="tr"> | |
<head> | |
<title> JSON Encoder </title> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> | |
<?php | |
if($_POST) { | |
$unicodes = array('\u015f', '\u015e', '\u011f', '\u011e', '\u0130', '\u0131', '\u00fc', '\u00dc', '\u00d6', '\u00f6', '\u00c7', '\u00e7'); |