Skip to content

Instantly share code, notes, and snippets.

# remove all script tags
html_content = html_content.gsub(/<script.*?>[\s\S]*<\/script>/i, "")
@house9
house9 / routes_link_to_in_rails_console.rb
Created November 12, 2011 23:34
Sample Routes and Links with Rails 3 in the console
--------------------------------------------
-- login as superuser
-- use sample_database
-- do not allow users to create tables by default
REVOKE CREATE ON SCHEMA public FROM public;
-- application user
CREATE USER tablecreator;
ALTER USER tablecreator WITH ENCRYPTED PASSWORD 'password';
.pagination { padding: 3px; margin: 3px; }
.pagination a { padding: 2px 5px 2px 5px; margin: 2px; border: 1px solid #aaaadd; text-decoration: none; color: #000099; }
.pagination a:hover,
.pagination a:active { border: 1px solid #000099; color: #000; }
.pagination span.current { padding: 2px 5px 2px 5px; margin: 2px; border: 1px solid #000099; font-weight: bold; background-color: #000099; color: #FFF; }
.pagination span.disabled { padding: 2px 5px 2px 5px; margin: 2px; border: 1px solid #eee; color: #ddd; }
/* From http://workingwithrails.com/railsplugin/4765-will-paginate */
@house9
house9 / git-workflow.rb
Created February 4, 2012 01:54
Git Workflow - add/commit/pull --rebase/push
Always start with
# get the latest code
git checkout master
git pull --rebase
# ==============
Setup to work on new branch / feature
You are going to be doing one of two things before adding new changes:
------------
for own key, generator of params
------------
http://stackoverflow.com/questions/22001912/prettify-json-output-of-active-model-serializer-in-rails-console?answertab=active#tab-top
puts JSON.pretty_generate(FooSerializer.new(p).serializable_hash)
open /Applications/Xcode.app/Contents/Applications/FileMerge.app/
// https://css-tricks.com/responsive-data-tables/
// https://css-tricks.com/examples/ResponsiveTables/responsive.php
// http://elvery.net/demo/responsive-tables/
.no-more-tables-container {
@mixin no-more-tables-mixin {
// Force table to not be like tables anymore
table, thead, tbody, th, td, tr {
display: block;
}
host SOMEDOMAIN.COM
# where ns1.isp.com is one of your ISP DNS servers
nslookup SOMEDOMAIN.COM ns1.isp.com
dig SOMEDOMAIN.COM @ns1.isp.com
traceroute SOMEDOMAIN.COM
# on MAC flush dns cache
# given a file with a number on each line
# 1) add a comma to the end of each
q a # record and store in 'a'
A,<esc>j # Go to end of line in insert mode, type , go to next line
q # stop recording
50@a # run the recording 50 times
# 2) put all on a single line
:1,50j