Skip to content

Instantly share code, notes, and snippets.

View spejman's full-sized avatar

Sergio Espeja spejman

View GitHub Profile

Keybase proof

I hereby claim:

  • I am spejman on github.
  • I am spejman (https://keybase.io/spejman) on keybase.
  • I have a public key ASD09yvRJ-kME0tiJEQ9zTkaJ2Jz1jpAh3UCbAz5fAuFygo

To claim this, I am signing this object:

defmodule BFFWeb.V2.UnreadNotificationsController do
use BFFWeb, :controller
def index(conn, params) do
{conversations_count, offers_pending_count, jobs_pending_count} =
async with {:ok, candidate_id} <- Candidates.get_current_candidate_id(conn.assigns.auth_token),
{:ok, conversations_count} <- Conversations.count_unread_conversations(candidate_id),
{:ok, offers_pending_count} <- Transactions.count_offers_pending(candidate_id),
{:ok, jobs_pending_count} <- Transactions.count_jobs_pending(candidate_id) do
{conversations_count, offers_pending_count, jobs_pending_count}
@spejman
spejman / Creating Shazam in Java
Created July 8, 2010 15:29 — forked from mort/Creating Shazam in Java
Algoritmo de Shazam
A backup of http://sites.google.com/site/redcodenl/creating-shazam-in-java-1 just in case
Why is this necessary? Read http://sites.google.com/site/redcodenl/patent-infringement
Please fork, tweet about, etc.
----
Creating Shazam in Java
A couple of days ago I encountered this article: How Shazam Works
This got me interested in how a program like Shazam works… And more importantly, how hard is it to program something similar in Java?
# Integration Test for ExceptionNotifier
# Please change this values for your own purposes:
# * UsersController
# * users_path
#
# Author: http://fernandoguillen.info
#
require 'test_helper'
~$ ARCHFLAGS='-arch i386 -arch x86_64'
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download
~$ tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0
~/RubyCocoa-1.0.0$ ruby install.rb config --build-universal=yes
~/RubyCocoa-1.0.0$ ruby install.rb setup
~/RubyCocoa-1.0.0$ sudo ruby install.rb install
# Run rake db:size to get a print of your database size in bytes.
# Run rake db:tables:size to get the sizes for individual tables
# Works for MySQL and PostgreSQL. Not tested elsewhere.
namespace :db do
desc 'Print data size for entire database'
task :size => :environment do
database_name = ActiveRecord::Base.connection.instance_variable_get("@config")[:database]
adapter = ActiveRecord::Base.connection.adapter_name.downcase
// Based on Zhao Lu Ubiquity < 0.5 command
CmdUtils.CreateCommand({
names: ['rails', 'search rails documentation'],
arguments: [{role: 'object', nountype: noun_arb_text, label: 'method'}],
icon: "http://rubyonrails.org/images/rails.png",
homepage: "",
author: {name: "Sergio Espeja", email: "sergio.espeja@gmail.com"},
license: "MPL,GPL",
description: "Search rails documentation",
help: "Type a rails class or method",
@spejman
spejman / gist:265292
Created December 29, 2009 12:50
Ubiquity 0.5 command for seaching in Spotify
// Based on http://anders.mellbratt.se/lastspot.html Thanks to Anders Mellbratt
CmdUtils.CreateCommand({
names: ['spotify search'],
arguments: [{role: 'object', nountype: noun_arb_text, label: 'music seach'}],
icon: "http://www.spotify.com/favicon.ico",
description: "Performs a search in Spotify",
author: {name: "Sergio Espeja", email: "sergio.espeja@gmail.com"},
homepage: "http://sergioespeja.com",
preview: function( pblock, args ) {
pblock.innerHTML = "Do a spotify search for: <i>" + args.object.text + "</i>";
@spejman
spejman / x
Created December 28, 2009 09:20 — forked from anonymous/x
CmdUtils.CreateCommand({
author: { name: "elbarto", email: "elbarto404@gmail.com"},
description: "search w3schools with google",
name: "w3",
takes: {"w3": noun_arb_text},
preview: function( pblock, searchTerm) {
pblock.innerHTML = "Searches w3schools for: " + searchTerm.text;
},
@spejman
spejman / LogIt.scpt
Created September 5, 2009 18:48 — forked from sippey/LogIt.scpt
This is a simple AppleScript designed for use with QuickSilver to log text to a file with a date and timestamp.
using terms from application "Quicksilver"
on process text log_text
set theDate to (do shell script "date '+%m-%d-%Y %H:%M'")
set theText to log_text
set theText to theDate & " " & theText & "
"
set thePosixFilePath to "/Users/msippey/Dropbox/taskpaper/log.txt" as string
set theFilePath to POSIX file thePosixFilePath
set theFileReference to open for access theFilePath with write permission
write theText to theFileReference starting at eof