Skip to content

Instantly share code, notes, and snippets.

View insidegui's full-sized avatar

Guilherme Rambo insidegui

View GitHub Profile
<?php
Config::write("database", array(
"development" => array(
"driver" => "mysql",
"host" => "localhost",
"user" => "root",
"password" => "",
"database" => "nome_do_banco",
"prefix" => "",
"charset" => "utf8"
@insidegui
insidegui / gist:940562
Created April 25, 2011 14:11
Spaghetti: configurar automaticamente banco de dados de acordo com ambiente
<?php
/**
* Com o environment, você pode escolher qual ambiente de desenvolvimento está
* utilizando. É principalmente utilizado na configuração de banco de dados,
* evitando que você tenha que redefiní-las a cada deploy.
*/
if(file_exists("production.txt")) {
Config::write("environment", "production");
} else {
Config::write("environment", "development");
#!/bin/bash
git push origin master
ssh user@server.com 'bash -s' < deploy_remote
cd ~/pasta_do_sistema_no_servidor_de_producao
git pull ~/.git/nomedorepositorio master
touch app/webroot/production.txt
@insidegui
insidegui / canvas.js
Created June 6, 2011 21:35
Extensões úteis para trabalhar com canvas
// frameRate padrão será 25fps
CanvasRenderingContext2D.prototype.frameRate = 1000/25
// setFrameRate(rate)
// @rate: frame rate a ser utilizado (em quadros por segundo - fps -) (ex: 30)
CanvasRenderingContext2D.prototype.setFrameRate = function(rate)
{
// transforma o frame rate passado de quadros por segundo para ms
this.frameRate = Math.round(1000/rate);
return this.frameRate;
@insidegui
insidegui / php_randomdotorg.php
Created June 2, 2013 00:30
Função para obter lista de números aleatórios usando a API do site random.org. Verifica a quota com o serviço e quando necessário usa números pseudo-aleatórios como fallback.
<?php
// retorna array contendo informacoes e um array de numeros aleatórios
// num -> quantidade de numeros que deve gerar
// amount -> número máximo que pode ser gerado
// force_pseudo -> não utilizar o serviço random.org e gerar números pseudo-aleatórios
function get_random_numbers($num, $amount, $force_pseudo=false)
{
// verifica a quota do servidor com o random.org para ver se é seguro fazer uma requisição agora
$c_quota = curl_init("http://www.random.org/quota/?format=plain");
curl_setopt($c_quota, CURLOPT_RETURNTRANSFER, true);
diff -Nru prl_fs.orig/SharedFolders/Guest/Linux/prl_fs/inode.c prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c
--- prl_fs.orig/SharedFolders/Guest/Linux/prl_fs/inode.c 2013-11-11 17:56:58.000000000 +0200
+++ prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c 2013-11-29 20:41:53.689167040 +0200
@@ -199,10 +199,18 @@
if (attr->valid & _PATTR_MODE)
inode->i_mode = (inode->i_mode & S_IFMT) | (attr->mode & 0777);
if ((attr->valid & _PATTR_UID) &&
- (sbi->plain || sbi->share || attr->uid == -1))
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+ (sbi->plain || sbi->share || __kuid_val(attr->uid) == -1))
@insidegui
insidegui / gist:7ed3bb342618ad5bebee
Created July 7, 2014 14:09
SQL para banco de dados da aula sobre PDO
-- Create syntax for TABLE 'lists'
CREATE TABLE `lists` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`color` varchar(7) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Create syntax for TABLE 'tasks'
CREATE TABLE `tasks` (
@insidegui
insidegui / gist:4bc3818e99233f9bf756
Created August 2, 2014 17:00
QTX Window with FOTWindow
_window.titleBarDrawingBlock = ^(BOOL drawsAsMainWindow, NSRect drawingRect, NSBezierPath *clippingPath){
NSColor* fillColor = [NSColor colorWithCalibratedRed: 0.076 green: 0.073 blue: 0.076 alpha: 1];
NSColor* strokeColor = [NSColor colorWithCalibratedRed: 0.289 green: 0.289 blue: 0.289 alpha: 1];
NSColor* gradientColor = [NSColor colorWithCalibratedRed: 0.179 green: 0.179 blue: 0.179 alpha: 1];
NSColor* shadowColor2 = [NSColor colorWithCalibratedRed: 0.719 green: 0.714 blue: 0.719 alpha: 1];
NSGradient* gradient = [[NSGradient alloc] initWithColorsAndLocations:
strokeColor, 0.0,
gradientColor, 0.50,
fillColor, 0.51, nil];
@insidegui
insidegui / gist:1f02408e53ce8133e06b
Last active August 29, 2015 14:22
Sessions in Presidio (WWDC 2015)
- Apple Watch Design Tips and Tricks
- Keynote
- How to Discover a Planet: An Evolution of Search and Discovery
- Making Magic: Creative Imagination Meets Technological Innovation
- Think Audacious
- Apple Design Awards
- Platforms State of the Union
- Performance on iOS and watchOS
- App Thinning in Xcode
- Advanced NSOperations