Skip to content

Instantly share code, notes, and snippets.

View brunofrank's full-sized avatar
🏠
Working from home

Bruno Frank brunofrank

🏠
Working from home
  • Frank Labs
  • Uruaçu, GO, Brazil
View GitHub Profile
@brunofrank
brunofrank / gist:2025969
Created March 13, 2012 01:12
Popup blocker detector tested on Chrome, Firefox, Safari and IE
var test = window.open(null,"","width=1,height=1");
setTimeout(function(){
if (test && test.innerHeight && test.innerHeight > 0) {
// POPUP BLOCKER DISABLED
test.close();
}
}, 10);
@brunofrank
brunofrank / gist:c1cdcb0522b8a3049df3
Last active December 27, 2018 16:34
Install ruby from source
apt-get install build-essential vim git-core curl
apt-get install bison openssl zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf libc6-dev
apt-get install libcurl4-openssl-dev libapr1-dev libaprutil1-dev libedit-dev libreadline-dev
for Ubuntu 18
apt purge libssl-dev && apt install libssl1.0-dev
#
# Recurring Job using Delayed::Job
#
# Setup Your job the "plain-old" DJ (perform) way, include this module
# and Your handler will re-schedule itself every time it succeeds.
#
# Sample :
#
# class MyJob
# include Delayed::ScheduledJob
@brunofrank
brunofrank / gist:63dc79e629f9d81faaeb
Created June 30, 2014 10:56
Porta seria no Android via Bluetooth
http://www.instructables.com/id/Androino-Talk-with-an-Arduino-from-your-Android-d/?lang=pt
@brunofrank
brunofrank / gist:24cacd14ffac4687ccf1
Created November 18, 2014 12:06
Dropbox class for CarrierWave
# encoding: utf-8
require 'dropbox_sdk'
class CarrierWave::Uploader::Base
add_config :dropbox_app_key
add_config :dropbox_app_secret
add_config :dropbox_access_token
add_config :dropbox_access_token_secret
add_config :dropbox_user_id
@brunofrank
brunofrank / deploy.rb
Last active August 29, 2015 14:26 — forked from dpsk/deploy.rb
Nginx+Unicorn (production-ready setup)
# Capistrano configuration
#
# require 'new_relic/recipes' - Newrelic notification about deployment
# require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production.
# set :deploy_via, :remote_cache - fetch only latest changes during deployment
# set :normalize_asset_timestamps - no need to touch (date modification) every assets
# "deploy:web:disable" - traditional maintenance page (during DB migrations deployment)
# task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP
void getAndPrintGameTable(){
char gamesTable[12800];
memset(gamesTable, 0, 12800);
int iRet;
GL_Dialog_Message(xGoal, NULL, "Aguarde...", GL_ICON_INFORMATION, GL_BUTTON_NONE, 0);
iRet = GetJsonFromServer("GET_GAMES_TABLE", gamesTable);
if (iRet >= 0)
printGameTable(gamesTable);
@brunofrank
brunofrank / jobs.rb
Created September 21, 2016 12:19
Recurrent jobs with DJ
class MyJob
include Delayed::ScheduledJob
run_every 1.hour
end
class MyJob2
include Delayed::ScheduledJob
run_every 1.day
@brunofrank
brunofrank / btg.js
Created October 10, 2016 13:26
Código BTG
<script src="//i.btg360.com.br/bs.js" type="text/javascript"></script>
<script type="text/javascript">
__bsd["id"] = "258:1";
__bsd["debug"] = true;
__bsd["track"] = "on";
try {
bs.setaCliente({
"email": "bfscordeiro@gmail.com"
});
class String
def to_delocalized_decimal
delimiter = I18n::t('number.format.delimiter')
separator = I18n::t('number.format.separator')
self.gsub(/[#{delimiter}]/, '').gsub(separator, '.')
end
def to_delocalized_money
unit = I18n::t('number.currency.format.unit')
delimiter = I18n::t('number.currency.format.delimiter')