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
#
# 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
@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 / 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"
});
//= require jquery.maskMoney
//= require jquery.mask
var Mask = {
phoneMasks: ['(00) 00000-0000', '(00) 0000-00000'],
maskBehavior: function (val, e, field, options){
return val.length > 14 ? Mask.phoneMasks[0] : Mask.phoneMasks[1];
},
@brunofrank
brunofrank / one_signal.rb
Created September 9, 2017 14:47
Class to make a push to OneSignal API
class OneSignal
APP_ID = 'ONE_SIGNAL_APP_ID'
API_KEY = 'ONE_SIGNAL_APP_KEY'
def initialize(title, body, data, players)
@title, @body, @data, @players = title, body, data, players
end
def perform
params = {
setupOneSignal(){
this.oneSignal.startInit('ab4692d4...');
this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);
this.oneSignal.handleNotificationReceived().subscribe((jsonData) => {
if (jsonData.isAppInFocus){
let alert = this.alertCtrl.create({
title: notification.title,
message: notification.body,