Skip to content

Instantly share code, notes, and snippets.

<% @results.each do |key, value| %>
<%= render :partial => 'result', :locals => { :object => value } %>
<% end %>
# List all listening ports together with the PID of the associated process
sudo netstat -plunt
# -p Tell me the name of the program and it's PID
# -l that is listening
# -u on a UDP port.
# -n Give me numeric IP addresses (don't resolve them)
# -t oh, also TCP ports
@mileszs
mileszs / snippet.rb
Created February 26, 2009 20:07 — forked from jqr/snippet.rb
require 'rational'
class Numeric
def to_r(rounding = 10_000)
Rational((self * rounding).to_i, rounding)
end
end
class Rational
def to_proper
#!/bin/bash
# Unattended REE/Passenger installation
# Source: http://weblog.brightlight-ict.nl/2008/12/unattended-passenger-ruby-enterprise-installation-on-ubuntu-8/
# 15/03/09 Updated to use latest r.e.e. and passenger 2.1 and rewrote bits thanks to the comments left on my blog. Thanks guys
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi
if (Global.url_array.length > 4 && !(parseInt(section))) {
// stuff
}
var Organizations = {
setupAll: function() {
var section = Global.url_array[Global.url_array.length -1];
if (Global.url_array.length > 4 && !(parseInt(section))) {
console.log('before doSetupShow');
// Organizations.doSetupShow();
console.log('after doSetupShow');
}
setupOrgChooser('sidebar_organization_name', 'sidebar_organization_list', 'sidebar_org_id', 'sidebar_fullsearch', Application.goToOrganization);
sudo apt-get install -y apache2-mpm-prefork \
apache2-prefork-dev \
build-essential \
checkinstall \
gcc \
git-core \
gsfonts \
imagemagick \
irb \
libapache2-mod-passenger \
class LegislatorsController < ApplicationController
def search
respond_to do |format|
if cookies["zip"].to_s.blank?
format.html # search.html.erb
else
format.html { redirect_to legislators_url }
end
end
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:authentication => :plain,
:user_name => "[email protected]",
:password => "somepass"
}
<html>
<head>
<title>This title and shit</title>
</head>
<body>
<script type="text/javascript">
function someFunc() {
var title = document.title;
var loc = document.location.href;