Skip to content

Instantly share code, notes, and snippets.

HTML_TAG_REPLACEMENTS = {
'br' => "\n",
}
HTML_QUOTE_REPLACEMENTS = {
'quot' => '"',
'amp' => '&',
}
def strip_html(str, tag = HTML_TAG_REPLACEMENTS, quot = HTML_QUOTE_REPLACEMENTS)
str.gsub %r{
@gittmaan
gittmaan / rbenv-install-system-wide.sh
Created July 23, 2012 22:54 — forked from v1nc3ntlaw/rbenv-install-system-wide.sh
rbenv install ruby 1.9.3-p194 on Ubuntu
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl libssl-dev \
libreadline6 libreadline6-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev
@gittmaan
gittmaan / gist:4035409
Created November 7, 2012 23:41
Minitest rspec or spec matchers and shared behaviours
# 100.should be_multiple_of(10)
#rspec
Rspec::Matchers.define :be_multiple_of do |multiple|
match do |number|
number % multiple == 0
end
failure_message_for_should do |number|
"Expected #{number} to be multiple of #{multiple}"
.wrapper:hover > div > label{
background-position:left bottom;
}
label{
background:url('http://img833.imageshack.us/img833/5959/stard.png') no-repeat left bottom;
float:right;
line-height:20px;
padding-left:20px;
height:15px;
}
@gittmaan
gittmaan / designer.html
Last active August 29, 2015 14:13
designer
<link rel="import" href="../ace-element/ace-element.html">
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../google-map/google-map.html">
@gittmaan
gittmaan / gist:0cf16fb0a1b3bb15ea3c
Created December 1, 2015 03:58 — forked from progrium/gist:5734609
Let unprivileged processes easily restart/reload Nginx without sudo or setuid hacks
# run this as root
while [ 1 ]; do echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload; done
# or as an upstart job
script
echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload
end script
respawn
# now any process can run this or do the equivalent with sockets to trigger reload
@gittmaan
gittmaan / supervisord
Created December 5, 2015 00:27
centos6 supervisord init script
#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
#
# chkconfig: - 64 36
@gittmaan
gittmaan / gist:663e4403f69e531aac130ea5e724871e
Created April 17, 2017 04:52 — forked from aaronshaf/bookmarklet-expanded.js
Copy text from Amazon's Cloud Reader
// Useful for students in need of block quotes for their paper, etc.
// Execute the line in your JavaScript console
new_window=window.open();new_window.document.body.innerHTML = $('iframe').contents().find('iframe').contents().find('body').get(1).innerHTML;
javascript:new_window=window.open();new_window.document.body.innerHTML = $('iframe').contents().find('iframe').contents().find('body').get(1).innerHTML;
@gittmaan
gittmaan / cheap_downloader.rb
Created April 6, 2018 02:02 — forked from orlando/cheap_downloader.rb
destroyallsoftware cheap screencast downloader
#!/usr/bin/ruby
require 'rss'
#this assumes you have a cookies.txt with destroyallsoftware.com cookies... later ill add a signin method..
class Link
attr_accessor :link,:title,:date
def initialize(link,title,date)
@link = link