Skip to content

Instantly share code, notes, and snippets.

View kennym's full-sized avatar

Kenny Meyer kennym

View GitHub Profile
@kennym
kennym / file1.sh
Created September 8, 2012 21:26
git rev-parse HEAD
git rev-parse HEAD
@kennym
kennym / file1.erb
Created September 8, 2012 21:16
application.html.erb
<footer class="clearfix">
<p>Created by <a href="mailto:[email protected]">Kenny Meyer</a>
<% cache do %>
(HEAD: <%= git_version %>)
<% end %>
</p>
</footer>
module ApplicationHelper
def git_version
require 'grit'
repo = Grit::Repo.new(Rails.root + '.git')
# For the sake of brevity just display the first 6 chars of the commit id
last_commit = repo.commits.first.id[0..5]
#{last_commit}
end
end
/* Some CSS here */
<% unless Rails.env.test? %>
@import "font-awesome";
<% end %>
/* More CSS here */
@kennym
kennym / database.yml
Created April 18, 2012 14:19
AW-ETL configuration
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
@kennym
kennym / indexer.php
Created April 4, 2012 12:00
Elastic Search indexer
<?php
/*
1. Connect to database.
2. Fetch 100 records from database.
3. Make curl PUT request to Elastic Search server
*/
$DB_NAME = "abc";
$DB_SCHEMA = "";
$DB_TABLE = "";
@kennym
kennym / homefinder.rb
Created March 30, 2012 21:03
Clasipar Home finder
# Licensed under DO-WHATEVER-THE-FUCK-YOU-WANT-WITH-THIS-CODE license.
# Self-explanatory.
# What this script does:
#
# 1. Request clasipar.com section inmuebles alquiler in Asuncion
# 2. Parse request
# 3. Parse all 'clasificados'
# 4. Write them to a file, and append new ones to the top.
#
@kennym
kennym / SampleController.rb
Created March 23, 2012 02:05
Sencha Touch JSON-P and Ruby on Rails
class SampleController < ApplicationController
respond_to :json
def index
@nodes = Node.all
render :json => @nodes.to_json, :callback => params[:callback]
end
end
@kennym
kennym / README
Created March 11, 2012 20:07
Secret Santa solution
http://www.rubyquiz.com/quiz2.html
#!/bin/sh
# Lee el nombre de un archivo como primer argumento
for i in `more $1 `
do
# Generar un nuevo pass con `pwgen`
pass=`pwgen -1 -N 1`
# Cambiar contrasenha
echo $pass|passwd $i --stdin > /dev/null
# Imprimir usuario y pass