Skip to content

Instantly share code, notes, and snippets.

@mauriciopasquier
mauriciopasquier / mails-senadores.rb
Last active September 4, 2015 01:14
Script para extraer todos los mails de los senadores nacionales de la República Argentina y guardarlos en un txt separados por comas, útil para mandarles mails
# Script para extraer todos los mails de los senadores
# nacionales de la República Argentina y guardarlos en
# un csv/txt separados por comas.
require 'nokogiri'
require 'open-uri'
senadores = Array.new
web = Nokogiri::HTML(open('http://www.senado.gov.ar/web/senadores/senadores.php', :proxy => false))
# User model
class Usuario < ActiveRecord::Base
rolify :role_cname => 'Rol'
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
class ActionView::Helpers::InstanceTag
DEFAULT_FIELD_OPTIONS.delete("size")
DEFAULT_TEXT_AREA_OPTIONS.delete("rows")
DEFAULT_TEXT_AREA_OPTIONS.delete("cols")
end
$:<< File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
require 'cinch'
class TurnBot
include Cinch::Plugin
def initialize(*args)
super
@turns = []
@mauriciopasquier
mauriciopasquier / style
Last active December 24, 2015 09:59
Bootstrap style checkbox with pure css
input[type="checkbox"].bootstrapear {
display: none;
& + label {
display: inline;
position: relative;
@include border-radius(5px);
padding: 4px 6px;
margin-left: 0;
module HTML
class StathamSanitizer < WhiteListSanitizer
protected
def tokenize(text, options)
super.map do |token|
if token.is_a?(HTML::Tag) && options[:parent].include?(token.name)
token.to_s.gsub(/</, "&lt;")
else
#!/usr/bin/env ruby
#
# stevie_chambers@viewyonder.com July 2012
#
# I'm playing around with APIs, and sharing my learnings
# You can follow my trials and tribulations at http://viewyonder.com/apis
#
# This is a simple Ruby script to show how a simple API might work.
# The resource model is just a simple array of a single class - no back-end store (yet)
#
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never">
<!-- This style was edited with the Visual CSL Editor (http://steveridout.com/csl/visualEditor/) -->
<info>
<title>American Psychological Association 6th Edition - Spanish Translation</title>
<id>https://gist.github.com/4225434</id>
<link href="http://www.zotero.org/styles/apa" rel="self"/>
<link href="http://owl.english.purdue.edu/owl/resource/560/01/" rel="documentation"/>
<author>
<name>Simon Kornblith</name>
  • This creates a 560mb ramdisk. Adjust the size accordingly. I think the number at the end of the command is the number of disk blocks. They are 2kb in size for me.
  • Restarting postgres is not necessary; you can create the ramdisk and tablespace while postgres is running.
  • You will lose all data in the ramdisk tablespace when you shut your machine down

  $ diskutil erasevolume HFS+ "postgres_ramdisk" `hdiutil attach -nomount ram://1165430`
  Started erase on disk1
  Unmounting disk
  Erasing
 Initialized /dev/rdisk1 as a 569 MB HFS Plus volume
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cartografía</title>
<script type="text/javascript" src="LibreVPN_files/d3.js"></script>
<script type="text/javascript" src="LibreVPN_files/index.js"></script>
<link type="text/css" rel="stylesheet" href="LibreVPN_files/force.css">
<link type="text/css" rel="stylesheet" href="LibreVPN_files/example-styles.css">