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 () { | |
| var displayOnlineStatus = document.getElementById("online-status"), | |
| isOnline = function () { | |
| displayOnlineStatus.innerHTML = "Online"; | |
| displayOnlineStatus.className = "online"; | |
| }, | |
| isOffline = function () { | |
| displayOnlineStatus.innerHTML = "Offline"; | |
| displayOnlineStatus.className = "offline"; | |
| }; |
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 | |
| class AppHelper extends Helper { | |
| function url($url = null, $full = false) { | |
| $routerUrl = Router::url($url, $full); | |
| if (!preg_match('/\\.(rss|html|js|css|jpeg|jpg|gif|png|xml?)$/', strtolower($routerUrl)) && substr($routerUrl, -1) != '/') { | |
| $routerUrl .= '/'; | |
| } | |
| return $routerUrl; | |
| } | |
| } |
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
| proxy_set_header X-Forwarded-Protocol $scheme; |
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
| #Timezone por defecto | |
| SetEnv TZ America/Santiago |
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 QueryString = function () { | |
| var query_string = {}, | |
| query = window.location.search.substring(1), | |
| vars = query.split("&"); | |
| for (var i=0;i<vars.length;i++) { | |
| var pair = vars[i].split("="); | |
| if (typeof query_string[pair[0]] === "undefined") { | |
| query_string[pair[0]] = pair[1]; | |
| } else if (typeof query_string[pair[0]] === "string") { |
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
| # Sort a list of dictionary objects by a key - case sensitive | |
| from operator import itemgetter | |
| mylist = sorted(mylist, key=itemgetter('name')) | |
| # Sort a list of dictionary objects by a key - case insensitive | |
| mylist = sorted(mylist, key=lambda k: k['name'].lower()) |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| from django import forms | |
| from django.forms.fields import FileField | |
| from django.core.exceptions import ValidationError | |
| class BaseForm: | |
| def _clean_fields(self): |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| from random import choice | |
| def password(length=10): | |
| s = [choice('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') for i in range(length)] | |
| return "".join(s) |
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
| wget --limit-rate=200k --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla http://example.com |