Skip to content

Instantly share code, notes, and snippets.


Berg Paulo bergpb

View GitHub Profile
kstroud1 / sources.list
Created Nov 17, 2014
sources.list for 13.04
View sources.list
# deb cdrom:[Ubuntu 13.04 _Raring Ringtail_ - Release amd64 (20130424)]/ raring main restricted
# See for how to upgrade to
# newer versions of the distribution.
deb raring main restricted
deb-src raring main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb raring-updates main restricted
sarahhodne / gist:1341827
Created Nov 5, 2011
Use pry for rails console
View gist:1341827
# Launch Pry with access to the entire Rails stack.
# If you have Pry in your Gemfile, you can pass: ./script/console --irb=pry
# instead. If you don't, you can load it through the lines below :)
rails = File.join(Dir.getwd, 'config', 'environment.rb')
if File.exist?(rails) && ENV['SKIP_RAILS'].nil?
require rails
if Rails.version[0..0] == '2'
require 'console_app'
cuth / serve.js
Created Apr 14, 2014
Run a local express server on the current directory's static files using node
View serve.js
var host = "";
var port = 1337;
var express = require("express");
var app = express();
app.use('/', express.static(__dirname + '/'));
app.listen(port, host);
console.log('Running server at http://localhost:' + port + '/');
michalc /
Created Mar 7, 2019
Django + gevent + psycopg2 download whole PostgreSQL table as CSV
import csv
import logging
import gevent
from psycopg2 import (
from django.conf import (
View .pryrc
# === EDITOR ===
Pry.editor = 'vim'
# == Pry-Nav - Using pry as a debugger ==
Pry.commands.alias_command 'c', 'continue' rescue nil
Pry.commands.alias_command 's', 'step' rescue nil
Pry.commands.alias_command 'n', 'next' rescue nil
Pry.commands.alias_command 'r!', 'reload!' rescue nil
Pry.config.color = true
Levantado /
Last active Sep 9, 2019
Flask WTF custom validator
from wtforms.validators import ValidationError
class UniqChecker:
def __init__(self, model, fieldname, message=None):
if message:
self.message = message
self.message = "You shall no pass"
self.model = model
zspecza / amok_browserify_gulpfile.js
Last active Sep 29, 2019
Live inject CSS, Javascript & HTML with BrowserSync, Watchify, Amok & Gulp (excuse the messiness, still a WIP)
View amok_browserify_gulpfile.js
build tasks
* This gulpfile is optimised for developing
* React.js apps in ES6 through Babel, and is
* designed to live-inject CSS, HTML and even JavaScript
* changes so maintaining state in an application when
* editing code is super easy.

##Fixing npm permissions

You may receive an EACCES error when you try to install a package globally. This indicates that you do not have permission to write to the directories that npm uses to store global packages and commands.

You can fix this problem using one of three options:

Change the permission to npm's default directory. Change npm's default directory to another directory. Install Node with a package manager that takes care of this for you. You should back-up your computer before moving forward.

daltonjorge /
Created Aug 8, 2012 — forked from hakagura/
Explicações de conceitos do Rails e outras infos úteis.

Active Record

É um design pattern que o Rails implementa a partir da gem ActiveRecord.

Serve para conectar a camada Model da aplicação com tabelas do database, para assim criar um modelo de domínio persistível, onde a lógica (Model) e dados (BD) são apresentados em uma única solução.

Já persiste no BD:

runemadsen / app.rb
Created Oct 17, 2012
Sinatra File Upload
View app.rb
require 'sinatra'
get "/" do
erb :form
post '/save_image' do
@filename = params[:file][:filename]
file = params[:file][:tempfile]