This file contains hidden or 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
| <?php | |
| function laboral_days($start, $end, $nowork = array('sun', 'sat'), $festives = array()){ | |
| $days = array('sat' => 5, 'sun' => 6); | |
| $time_start = strtotime($start); | |
| $time_end = strtotime($end); | |
| $day_init = date('w', $time_start); | |
| $day_end = date('w', $time_end); | |
| $total_days = ($time_end - $time_start) / (60 * 60 * 24) + 1; | |
| $weeks = floor($total_days / 7); |
This file contains hidden or 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
| SELECT table_name AS "Tables", | |
| round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB" | |
| FROM information_schema.TABLES | |
| WHERE table_schema = |
This file contains hidden or 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
| TIME=10 | |
| for ID in $( mysql information_schema -e "SELECT ID FROM processlist WHERE INFO REGEXP '^[Ss][Ee][Ll][Ee][Cc][Tt]' AND TIME >= ${TIME};" ) | |
| do | |
| echo -n "Killing thread ${ID}..." | |
| mysqladmin kill ${ID} | |
| echo " Done" | |
| done |
This file contains hidden or 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
| # Where to put virtualenvs? | |
| virtualenv_basedir="/home/vagrant/sites/virtualenvs" | |
| # Where to put project dirs? | |
| project_basedir="/home/vagrant/sites/projects" | |
| # Comma seperated list of dirs where Chuck should look for modules. | |
| # . will be replaced with the Django Chuck modules dir | |
| module_basedirs = ["."] |
This file contains hidden or 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
| # urls.py | |
| urlpatterns += patterns('', | |
| (r'^(?P<page_alias>.+?)/$', 'views.static_page'), | |
| ) | |
| # views.py | |
| def static_page(request, page_alias): # page_alias holds the part of the url | |
| try: | |
| active = Page.objects.get(page_alias=page_alias) | |
| except Page.DoesNotExist: |
This file contains hidden or 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
| --with-libdir=/lib/x86_64-linux-gnu |
This file contains hidden or 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
| <?php | |
| // http://www.elasticsearch.com/docs/elasticsearch/rest_api/ | |
| class ElasticSearch { | |
| public $index; | |
| function __construct($server = 'http://localhost:9200'){ | |
| $this->server = $server; | |
| } |
This file contains hidden or 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($) { | |
| $.fn.jCarouselLite = function(o) { | |
| o = $.extend({ | |
| btnPrev: null, | |
| btnNext: null, | |
| btnGo: null, | |
| mouseWheel: false, | |
| auto: null, | |
| speed: 200, |
This file contains hidden or 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
| mvn -Dmaven.test.skip=true compile package assembly:single |
This file contains hidden or 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 letras = [0,1,2,3,4,5,6,7,8,9,'A','a','B','b','C','c','D','d','E','e','F','f','G','g','H','h','I','i','J','j','K','k','L','l','M','m','N','n','O','o','P','p','Q','q','R','r','S','s','T','t','U','u','V','v','W','w','X','x','Y','y','Z','z']; | |
| function encode_shortener(num){ | |
| var t = letras.length; | |
| var shorten = ''; | |
| while(num > 0){ | |
| var div = Math.floor(num / t); | |
| var res = num - div * t; | |