Skip to content

Instantly share code, notes, and snippets.

View benoror's full-sized avatar
🌀
In a quantum state between coding and procrastinating

Ben Orozco benoror

🌀
In a quantum state between coding and procrastinating
View GitHub Profile
@benoror
benoror / airtable-proxy.js
Last active April 19, 2020 10:51
Node.js Airtable API Proxy
var express = require('express');
var proxy = require('http-proxy-middleware');
var options = {
logLevel: 'debug',
target: 'https://api.airtable.com/v0/' + process.env.APP_ID,
changeOrigin: true,
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer ' + process.env.API_KEY
},
@benoror
benoror / Rails Console Actionmailer test.rb
Last active November 20, 2016 00:57 — forked from tansengming/Rails Console Actionmailer test.rb
Rails Console Actionmailer test
# Copy and paste this to the rails console to test your email settings
class MyMailer < ActionMailer::Base
def test_email
set_tracking_headers 'test_campaign'
@recipients = "benoror@gmail.com"
@from = "Equipo Nimbo X <hola@" + Rails.application.secrets.sparkpost_domain + ">"
@subject = "sparkpost email test with open & click tracking"
@body = "This is a test email. With a <a href=\"http://blog.nimbo-x.com/nimbo-x-gold/\">test link</a>."
@benoror
benoror / template.hbs
Created July 25, 2016 13:37
<li> active links
{{#link-to 'My Link' obj tagName="li" href=false}}
<a {{bind-attr href="view.href"}} style="cursor:pointer;">{{obj.name}}</a>
{{/link-to}}
@benoror
benoror / controllers.application.js
Last active July 19, 2016 18:02
ember-jsoneditor/issues/13
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@benoror
benoror / application-route.js
Last active July 5, 2016 01:06
modal-message actions pattern - part of post: https://medium.com/p/dc024bfa203c
//...
export default Route.extend({
//...
actions: {
//...
@benoror
benoror / application.hbs
Last active July 5, 2016 01:14
modal-message component pattern - part of post: https://medium.com/p/dc024bfa203c
<!--- ... --->
{{#if isShowingModal}}
{{modal-message
close=(route-action 'closeModalDialog')
options=modalOptions}}
{{/if}}
<!--- ... --->
class InstallFuzzystrmatchContribPackage < ActiveRecord::Migration
def up
execute "CREATE EXTENSION fuzzystrmatch;"
end
def down
execute "DROP EXTENSION fuzzystrmatch;"
end
end
@benoror
benoror / psql_fuzzy_search.md
Last active January 13, 2022 01:18
Research: PostgreSQL Fuzzy Search

Algorithms

Levenshtein (a.k.a. match difference)

Levenshtein distance is a string metric for measuring the difference between two sequences. Informally, the Levenshtein distance between two words is the minimum number of single-character edits (i.e. insertions, deletions or substitutions) required to change one word into the other.

Soundex (a.k.a. match soundalikes)

@benoror
benoror / airtable_serializer.js
Last active May 1, 2016 17:59
AirtableSerializer
import Ember from 'ember';
import DS from 'ember-data';
/*
* Override RESTSerializer since it's the closest to Airtable's afaik
*/
export default DS.RESTSerializer.extend({
/*
* Normalize each response from Airtable
@benoror
benoror / application_adapter.js
Created April 23, 2016 17:18
adapters/application.js
import DS from 'ember-data';
export default DS.JSONAPIAdapter.extend({
host: 'https://api.airtable.com',
namespace: 'v0/appL0nGiD3nT1f1c4t0r',
headers: {
'Accept': 'application/json',