Skip to content

Instantly share code, notes, and snippets.

View terenceponce's full-sized avatar

Terence Ponce terenceponce

View GitHub Profile
@terenceponce
terenceponce / instructions.md
Created September 26, 2012 08:25
Setting up Thinking-Sphinx on Mac OS X using Homebrew

Out of the box, Homebrew does a default installation on Sphinx:

$ brew install sphinx

However, if you're using MySQL, the thinking-sphinx gem won't work because it needs to use MySQL libraries.

If you managed to screw up the first time, uninstall sphinx first:

$ brew remove sphinx

@terenceponce
terenceponce / shufti.json
Created September 7, 2022 16:00
Shufti Callback for status change
{"reference"=>"a0372417-2529-485c-a231-74d1f87320b2",
"event"=>"verification.declined",
"country"=>nil,
"proofs"=>
{"document"=>
{"proof"=>
"https://api.shuftipro.com/storage/8WlU2XYXo2SjV5yGOPRBtczXag0OvHb1wskRTMPIZppIxRHBHHaQTYGIfHTsheyh/document/proof.png?access_token=a6eb4d75a06c2059ea9739076fb1a1765ddd1fe9",
"additional_proof"=>
"https://api.shuftipro.com/storage/8WlU2XYXo2SjV5yGOPRBtczXag0OvHb1wskRTMPIZppIxRHBHHaQTYGIfHTsheyh/document/additional_proof.png?access_token=a6eb4d75a06c2059ea9739076fb1a1765ddd1fe9"},
"address"=>
@terenceponce
terenceponce / profile_management_spec.rb
Last active July 13, 2020 02:22
Creating Signed Cookies in Capybara
# spec/features/profile_management_spec.rb
require 'rails_helper'
feature 'Profile Management', type: :feature do
given!(:user) { create(:user) }
scenario 'User updates profile' do
cookie = SignedCookieGenerator.new(:auth, user.id)
page.driver.browser.set_cookie(cookie.to_s)
@terenceponce
terenceponce / keybase.md
Created November 8, 2019 03:26
keybase.md

Keybase proof

I hereby claim:

  • I am terenceponce on github.
  • I am terenceponce (https://keybase.io/terenceponce) on keybase.
  • I have a public key ASDrrHc7r8kil2CClC5J7PP00kVX1whnQg4r7pNIquiRIAo

To claim this, I am signing this object:

@terenceponce
terenceponce / README.md
Last active January 2, 2019 04:02
Setting up rbenv, Ruby 2.1, Rails 4.1.0.beta1, nginx, Passenger, PostgreSQL 9.1 on Ubuntu 12.04 LTS for Windows Azure

Setting up Ruby, Rails, Nginx, Passenger, PostgreSQL 9 on Ubuntu 12.04 LTS for Windows Azure

Last updated: 12/31/2013

Fix the locale issue

  • Edit /etc/default/locale as sudo.
  • Append LC_ALL="en_US.UTF-8" at the end of the file, save and quit.
  • sudo locale-gen en_US en_US.UTF-8
  • sudo dpkg-reconfigure locales

Install the necessary packages to install rbenv and build Ruby

@terenceponce
terenceponce / bitcoin.conf
Last active August 27, 2018 03:48
Omnicore config
# /home/omnicore/.bitcoin/bitcoin.conf
# [core]
datadir=/mnt/volume-sgp1-01/Omnicore
dbcache=1024
txindex=1
# [rpc]
server=1
rpcuser=user
@terenceponce
terenceponce / ruby_example.rb
Created August 1, 2016 02:40
Looker embed integration
require 'cgi'
require 'securerandom'
require 'uri'
require 'base64'
require 'json'
require 'openssl'
module LookerEmbedClient
def self.created_signed_embed_url(options)
# looker options
@terenceponce
terenceponce / a_problem.md
Created November 11, 2012 04:24
Content appears in my browser, but not in my test

I can see the content fine in my browser, but it doesn't appear in the the test. I checked the page with save_and_open_page and the categories that I created isn't in the generated page. What am I missing here?

This is the error that I'm getting:

  1. Categories index page when the user is signed in should be able to see a list of categories Failure/Error: page.should have_content category1.name expected there to be content "category-1" in "Gastos\n\n\n\n\n\n\n\n\nGastos\n\n\nHome\n\n\nAbout\n\n\nContact\n\n\n\nLogged in as\nfoo2@example.com\n\nEdit profile\nSign Out\n\n\n\n\n\n\n\nBrowse Categories\nName\n\n\n\n"

    ./spec/requests/categories_spec.rb:19:in `block (4 levels) in <top (required)>'

@terenceponce
terenceponce / problem.md
Created September 5, 2012 07:30
Implementing a decent trending algorithm in Rails

I'm trying to implement a trending feature. The trending feature is based on searches that have become viral in a span of 4 hours. It will get the 6 latest popular searches.

Of course, to pull that off, I created a model called Search that has a keyword field. Every search done on the application will be stored as one row in the Search table.

At the moment, this is what I'm doing to retrieve the keywords to be classified as trending:

@popular_search = Search.where('created_at >= ?', 4.hours.ago).group(:keyword).order('count_keyword DESC').limit(6).count(:keyword)
@terenceponce
terenceponce / database.yml
Created August 27, 2012 05:24
Rails 3 PostgreSQL sample config
development:
adapter: postgresql
encoding: unicode
database: applicationname_development
host: localhost
pool: 5
username: postgres
password: postgres
test: