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
from collections import namedtuple | |
from pymongo import MongoClient | |
from flask import request | |
from core.web.site import app | |
from core.web.site.views_master import * | |
import json | |
''' | |
$('#companies').dataTable( { | |
"bProcessing": true, |
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 config.mysql as dbconfig | |
from MysqlFactory import MysqlFactory | |
connection = MysqlFactory().getConnection(dbconfig.params) | |
cursor = connection.cursor() | |
query = """ | |
SELECT | |
* | |
FROM |
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
# -*- coding: utf-8 -*- | |
import MySQLdb as Mysql | |
class MysqlFactory(): | |
"""factory de conexão com mysql""" | |
def getConnection(self, config): | |
connection = Mysql.connect(config["host"],config["user"],config["password"]) | |
connection.select_db(config["db"]) | |
return connection; |
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
<?php | |
/** | |
* Cria uma instância da classe PDO, setando o modo de erro para gerar exceções | |
* | |
*/ | |
class PdoFactory { | |
public function __construct() { | |
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
<?php | |
ini_set('memory_limit', '512M'); | |
ini_set('date.timezone', "America/Sao_paulo"); | |
require_once 'PdoFactory.php'; | |
require_once 'Metadata.php'; | |
$config = include_once 'config/cron_config.php'; | |
function logsNulos($database) |
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
# Add this config | |
$ heroku config:add LD_LIBRARY_PATH=/app/php/ext:/app/apache/lib | |
# Login to Heroku CLI | |
$ heroku run bash | |
# The second argument here is the path to your script | |
~ $ ~/php/bin/php -f ~/www/index.php |
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/env python | |
#-*- coding: utf-8 -*- | |
""" | |
Tool for minifing static files with yui compressor | |
""" | |
import os | |
from subprocess import call | |
from optparse import OptionParser |
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
UDEV_RULE_PATH="/etc/udev/rules.d/51-android.rules" | |
ANDROID_RULE='SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"' | |
instala_regra_udev() { | |
echo $ANDROID_RULE >> $UDEV_RULE_PATH | |
sudo udevadm control --reload-rules | |
echo "Driver instalado com sucesso!" | |
} | |
if [ -f "$UDEV_RULE_PATH" ] |
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
Show hidden characters
{ | |
"cmd": ["g++", "$file", "-o", "$file_base_name", "-I/usr/local/include"], | |
"selector": "source.c++", | |
"windows": | |
{ | |
"cmd": ["cl", "/Fo${file_path}", "/O2", "$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
// middleware | |
app.use(express.bodyParser({ keepExtensions: true, uploadDir: __dirname + "/public/uploads" })) | |
// later | |
app.get('/photos', uploadFile, addPhoto) | |
// file is automatically saved to /public/uploads, let's just set | |
function uploadFile(req, res, next) { | |
if (req.files) { | |
req.body.url = "http://myawesomesite.com/" + req.files.file.path.split("/").slice(-2).join("/") |