Skip to content

Instantly share code, notes, and snippets.

View frankpinto's full-sized avatar

Frank Pinto frankpinto

View GitHub Profile
@frankpinto
frankpinto / fixes.patch
Created May 24, 2019 04:53
Pillow talk
diff --git a/public/script.js b/public/script.js
index 57bd5df..42ab788 100644
--- a/public/script.js
+++ b/public/script.js
@@ -1,5 +1,5 @@
-let globalData = '';
+window.globalData = '';
let selectedEvent = '';
@frankpinto
frankpinto / failed_doc_upload.log
Created June 13, 2018 16:48
GRPC debug output
D0613 12:34:16.149015455 29990 ev_posix.cc:131] Using polling engine: poll
D0613 12:34:16.149171806 29990 dns_resolver.cc:307] Using native dns resolver
I0613 12:34:16.151401059 29990 call.cc:631] OP[client-channel:0x7efff800d808]: SEND_INITIAL_METADATA{key=3a 70 61 74 68 ':path' value=2f 62 61 73 65 2e 42 61 73 65 2f 69 6e 73 65 72 74 53 33 44 61 74 61 '/base.Base/inser
tS3Data', key=3a 61 75 74 68 6f 72 69 74 79 ':authority' value=6c 6f 63 61 6c 68 6f 73 74 3a 34 36 30 35 31 'localhost:46051' deadline=60001} SEND_MESSAGE:flags=0x00000000:len=4217991 SEND_TRAILING_METADATA{} RECV_INITIAL_METADATA RECV_ME
SSAGE RECV_TRAILING_METADATA COLLECT_STATS:0x7efff800d588
D0613 12:34:16.151570198 29990 client_channel.cc:1424] chand=0x7efff8005068 calld=0x7efff800d828: entering client_channel combiner
D0613 12:34:16.151609716 29990 client_channel.cc:303] chand=0x7efff8005068: starting name resolution
D0613 12:34:16.151642277 29990 client_channel.cc:1280] chand=0
@frankpinto
frankpinto / Rakefile
Created July 6, 2017 17:34
A few Rakefile tasks that I used to manage my local database in the days of Ayalo. It prints a progress bar to the CLI that measures how much of the PostgreSQL database has been retrieved. It also has tasks to load the dump into the local database.
require 'dotenv/tasks'
require 'ruby-progressbar'
task default: %w(.env)
desc 'Setup necessary files and folders'
task setup: %w(tmp .env)
desc 'Copy .env.example to .env'
file '.env' do |t|
@frankpinto
frankpinto / utilities.scss
Last active January 23, 2017 19:16
Utilities that I use in several projects
/* Alerts */
.flash {
max-width: 100%;
margin: 0 auto;
padding: 15px 20px;
text-align: center;
&.success {
color: #333;
background-color: $brand-success;
@frankpinto
frankpinto / devise_stubbing.rb
Last active September 11, 2015 02:28
Stubbing devise with mocha
# rspec-mocks -> mocha + https://github.com/plataformatec/devise/wiki/How-To:-Stub-authentication-in-controller-specs
class StoresControllerTest < ActionController::TestCase
include Devise::TestHelpers
setup do
user = stub email: '[email protected]'
warden.stubs(:authenticate!).returns user
@controller.stubs(:current_user).returns user
end
@frankpinto
frankpinto / hangul-jamo.js
Created September 5, 2015 17:03
Hangul CommonJS
/* This was taken from https://github.com/teampopong/hangul-jamo-js/
* and converted to a CommonJS style module
*/
var // 초성
FIRST_CONSONANTS = [
'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ',
'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'
],
// 중성
VOWELS = [
@frankpinto
frankpinto / company_test.rb
Last active September 3, 2015 22:42
Failing test case w/ environment other than 'test'
require 'test_helper'
class CompanyTest < ActiveSupport::TestCase
def test_save_logo
fixtures_folder = Rails.root + 'test/fixtures/'
test_image_path = File.expand_path 'test-image.png', fixtures_folder
@test_image = File.open test_image_path, 'rb'
company = Company.new(name: 'Logo test')
company.logo = @test_image
@frankpinto
frankpinto / test_helper.rb
Created September 3, 2015 22:13
Rails 4.2.4 test helper
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end
@frankpinto
frankpinto / postgresql.sls
Created June 9, 2015 02:08
PostgreSQL salt file
"Remove broken precise PostgreSQL APT":
pkgrepo.absent:
- name: deb http://apt.postgresql.org/pub/repos/apt/ precise main
- dist: precise
- comps: main
"Remove precise PostgreSQL APT":
pkgrepo.absent:
- name: deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
@frankpinto
frankpinto / Rakefile
Last active August 29, 2015 14:22
Ruby s3 SDK example
task :fix_image_headers => :environment do
puts "---------------------------------------------"
puts "Uploading ad images to tools.ayalo.co"
puts "---------------------------------------------"
# Set s3 credentials
Dotenv.load
# Example of Client interface
s3 = Aws::S3::Client.new