Skip to content

Instantly share code, notes, and snippets.

@sibnerian
sibnerian / Heroku Devise email logs
Last active December 15, 2015 15:28
The relevent logs (from heroku)
2013-03-31T18:19:38+00:00 heroku[router]: at=info method=POST path=/users/password host=feed-me-maybe.herokuapp.com fwd="74.109.19.90" dyno=web.1 connect=4ms service=426ms status=500 bytes=643
2013-03-31T18:39:25+00:00 app[web.1]: Processing by Devise::PasswordsController#create as HTML
2013-03-31T18:39:25+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"YKmbGB92G/JG7RF9FKi8mprGjyLdPojNH4P3mkTRPl0=", "user"=>{"email"=>"sibnerian@gmail.com"}, "commit"=>"Send me reset password instructions"}
2013-03-31T18:39:25+00:00 app[web.1]: Rendered devise/mailer/reset_password_instructions.html.erb (0.9ms)
2013-03-31T18:39:25+00:00 app[web.1]:
2013-03-31T18:39:25+00:00 app[web.1]: Sent mail to sibnerian@gmail.com (445ms)
2013-03-31T18:39:25+00:00 app[web.1]: Completed 500 Internal Server Error in 679
@sibnerian
sibnerian / sed_replace.sh
Created July 18, 2014 16:54
Using sed to replace text in file on Mac OSX
sed_replace() {
# require all 3 parameters
if [ .$1 = . ] || [ .$2 = . ] || [ .$3 = . ]; then
echo "Usage: sed_replace [oldString] [newString] [targetFile]"
return 0
fi
local oldString=$1
local newString=$2
local targetFile=$3
local temp=`mktemp -t sed_replace.XXXXXXXXX`
{
// Required
"manifest_version": 2,
"name": "My Extension",
"version": "1.0.0",
// Recommended
"default_locale": "en",
"description": "A plain text description",
"icons": { "16": "icon16.png",
{
// Required
"manifest_version": 2, // manifest version number (always 2)
"name": "My Extension",
"version": "1.0.0",
// Recommended
"default_locale": "en",
"description": "A plain text description",
"icons": { "16": "icon16.png",
// when the extention is installed...
chrome.runtime.onInstalled.addListener(function() {
// replace all existing rules...
chrome.declarativeContent.onPageChanged.removeRules(undefined, function () {
// with these new rules:
chrome.declarativeContent.onPageChanged.addRules([
{
conditions: [],
@sibnerian
sibnerian / debounce.js
Last active July 10, 2019 20:15
Small, debounce function that works in Node and Browser
// Plucked from http://davidwalsh.name/javascript-debounce-function
// If you do use this in production, you should probably minify it
var debounce = function (func, wait, immediate) {
var timeout = null;
return function () {
var context = this;
var args = arguments;
var later = function() {
timeout = null;

TODO

  • Style /search (search bar & search options, results, maps/directions, footer, loading animation, etc)
  • Style splash layout (log in/account buttons should float right, not look silly)
  • Index page should actually give information about the app, also a link to search
CREATE INDEX stars2_idx ON businesses(stars2);
SELECT /*+ FIRST_ROWS(1) */
(SELECT /*+ ORDERED INDEX Businesses(stars2_idx) */ count(*) FROM Businesses WHERE stars2 >= 1 AND stars2 < 1.5) AS bucket1,
(SELECT /*+ ORDERED INDEX Businesses(stars2_idx) */ count(*) FROM Businesses WHERE stars2 >= 1.5 AND stars2 < 2) AS bucket2,
(SELECT /*+ ORDERED INDEX Businesses(stars2_idx) */ count(*) FROM Businesses WHERE stars2 >= 2 AND stars2 < 2.5) AS bucket3,
(SELECT /*+ ORDERED INDEX Businesses(stars2_idx) */ count(*) FROM Businesses WHERE stars2 >= 2.5 AND stars2 < 3) AS bucket4,
(SELECT /*+ ORDERED INDEX Businesses(stars2_idx) */ count(*) FROM Businesses WHERE stars2 >= 3 AND stars2 < 3.5) AS bucket5,
(SELECT /*+ ORDERED INDEX Businesses(stars2_idx) */ count(*) FROM Businesses WHERE stars2 >= 3.5 AND stars2 < 4) AS bucket6,
(SELECT /*+ ORDERED INDEX Businesses(stars2_idx) */ count(*) FROM Businesses WHERE stars2 >= 4 AND stars2 < 4.5) AS bucket7,
  • Implement bing search results to get an easy win to start off
  • Create stub methods for TFIDF and PAGE RANK for a given word
  • Create method to kill stop words in a query
  • Use stub data to implement query --> ranked documents method
  • Combine this with Bing data to get ranked URLs for query
  • Implement AJAX frontend with previews
@sibnerian
sibnerian / highland_batched_scraper.js
Created May 6, 2015 05:19
HighlandJS batched scraper
var _ = require('highland');
var cheerio = require('cheerio');
var request = require('request');
// request library, but with a node.js style callback - i.e. (err, res)
var req = function (url, cb) {
request(url, function (err, res, data) {
cb(err, data);
});
};