Skip to content

Instantly share code, notes, and snippets.

View rvillas's full-sized avatar

rvillas rvillas

View GitHub Profile
@rvillas
rvillas / pg_install.sh
Created May 21, 2015 23:33
install pg gem with postgres.app
gem install pg -v '0.18.1' -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
@rvillas
rvillas / pngquant_all
Created May 21, 2015 23:25
pngquant an entire folder
find . -name '*.png' -exec pngquant --ext .png --force {} \;
%w(rubygems sequel fileutils yaml active_support/inflector).each{|g| require g}
require File.join(File.dirname(__FILE__), "downmark_it")
module WordPress
def self.import(database, user, password, table_prefix = "wp", host = 'localhost')
db = Sequel.mysql(database, :user => user, :password => password, :host => host, :encoding => 'utf8')
%w(_posts _drafts images/posts/featured).each{|folder| FileUtils.mkdir_p folder}
@rvillas
rvillas / db.rake
Last active August 29, 2015 14:10 — forked from hopsoft/db.rake
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@rvillas
rvillas / demo.html
Last active August 29, 2015 14:01 — forked from zenlor/demo.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<script type='text/javascript' src='lazyload.js'></script>
<style type='text/css'>
body {