Skip to content

Instantly share code, notes, and snippets.

View jeduan's full-sized avatar

Jeduan Cornejo jeduan

View GitHub Profile
@jeduan
jeduan / index.js
Created March 20, 2014 22:42
Error handling in express 4
var express = require('express'),
logger = require('morgan')
var app = express();
var env = process.env.NODE_ENV || 'development';
var silent = env === 'test'
app.set('port', +process.env.PORT || 3000)
if (env === 'development') {
@jeduan
jeduan / db.js
Created May 26, 2014 14:56
db.js
var _ = require('underscore')
var config = require('../../config')
var mongoose = require('mongoose')
mongoose.connect(config.mongoUrl)
var db = mongoose.connection
mongoose.set('debug', !!config.mongoDebug)
db.on('error', function () {
return console.error.bind(console, '[mongo]: ')
})
@jeduan
jeduan / keybase.md
Last active August 29, 2015 14:05
keybase.md

Keybase proof

I hereby claim:

  • I am jeduan on github.
  • I am jeduan (https://keybase.io/jeduan) on keybase.
  • I have a public key whose fingerprint is B70B 4F2F 27B9 18F5 4100 0EBE 6709 8BD2 7AEF CF68

To claim this, I am signing this object:

@jeduan
jeduan / wifi-password.rb
Last active August 29, 2015 14:15
Homebrew Formulae for wifi-password
class WifiPassword < Formula
homepage "https://github.com/rauchg/wifi-password"
url "https://github.com/rauchg/wifi-password/archive/0.0.1.tar.gz"
version "0.0.1"
sha1 "7f92794a3a04762009a0c4525cbf2aa851002289"
def install
bin.install "wifi-password.sh" => "wifi-password"
end
end
public List<TableroControlTO> obtenTableroColegio(int cveunidad, int subgrupo, String anio) {
List<TableroControlTO> unidades = new ArrayList<TableroControlTO>();
Connection con = null;
try {
con = getDataSource().getConnection();
PreparedStatement pstm = con.prepareStatement("SELECT * FROM sistema.tableroestatal(?, ?, ?)");
pstm.setInt(1, cveunidad );
pstm.setInt(2, subgrupo);
$ dmesg
:0: [sda] Unhandled error code
[327491.642630] sd 0:0:0:0: [sda] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[327491.642636] sd 0:0:0:0: [sda] CDB: Read(10): 28 00 00 f8 c0 c7 00 00 08 00
[327491.642648] end_request: I/O error, dev sda, sector 16302279
[327491.646981] type=1505 audit(1313152772.682:1388): operation="profile_replace" pid=31237 name="/usr/sbin/mysqld"
[327521.806796] sd 0:0:0:0: [sda] Unhandled error code
[327521.806800] sd 0:0:0:0: [sda] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[327521.806806] sd 0:0:0:0: [sda] CDB: Read(10): 28 00 00 f8 c0 c7 00 00 08 00
[327521.806818] end_request: I/O error, dev sda, sector 16302279
@jeduan
jeduan / reveal_ajax.js
Created February 9, 2012 00:15
Use Zurb reveal with ajax
$('a.reveal').click(function(event) {
event.preventDefault();
var $div = $('<div>').addClass('reveal-modal').appendTo('body'),
$this = $(this);
$.get($this.attr('href'), function(data) {
return $div.empty().html(data).append('<a class="close-reveal-modal">&#215;</a>').reveal();
});
});
@jeduan
jeduan / Gemfile
Created September 13, 2012 17:01
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@jeduan
jeduan / apps_script_followers.md
Last active December 13, 2015 17:49
Made these quick functions to get the number of twitter followers and klout score of a given twitter username on Google Spreadsheets

Made these quick functions to get the number of twitter followers and klout score of a given twitter username.

Supports both @username and username as input.

To use them you have to create a Google Drive Spreadsheet and then go to Tools -> Script Editor, and then paste one or both Then the functions will be available as normal functions and you can use them as =followers(CELL_OR_SCREENNAME) and =klout(CELL_OR_SCREENNAME)