Skip to content

Instantly share code, notes, and snippets.

View ssaadh's full-sized avatar
🎯
Focusing

Saadh ssaadh

🎯
Focusing
View GitHub Profile
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
@tswicegood
tswicegood / sync_things.rb
Created October 1, 2009 20:13
Simple Ruby script to sync Basecamp and Things to-dos.
#!/usr/bin/env ruby
#
# Biggest problem with this is that it checks everything. Needs
# to be adjusted to only check N days and/or N tasks on Basecamp.
#
# Also has a problem in that Completed always wins. If you have a
# task marked at completed, then mark it as open again on just one
# side, it'll mark the other as completed if you run the sync again.
#
# All that said, it provides a basic, very rudimentary sync.
@obeattie
obeattie / basecamp-custom.css
Created November 17, 2009 12:18
A user stylesheet to make Basecamp a little bit prettier. Custom colors, a bit of jiggery-pokery with the header spacing, hide the milestones calendar from the dashboard page, hide the company logo (if you have one).
/* Basic color replacements */
a:link, a:visited {
color: #039 !important;
}
a:hover {
color: #fff !important;
background-color: #039 !important;
}
@hubgit
hubgit / facebook-login.sh
Created February 17, 2010 14:08
Login to Facebook using cURL
#!/bin/bash
# If it redirects to http://www.facebook.com/login.php at the end, wait a few minutes and try again
EMAIL='YOUR_EMAIL' # edit this
PASS='YOUR_PASSWORD' # edit this
COOKIES='cookies.txt'
USER_AGENT='Firefox/3.5'
#!/usr/bin/env ruby -rjcode -Ku
# TaskPaper to Markdown converter
# Usage: tp2md.rb filename.taskpaper > output.md
require 'ftools'
infile = ARGV[0]
title = File.basename(infile,'.taskpaper').upcase
output = "# #{title} #\n\n"
prevlevel = 0
begin
#!/usr/bin/env ruby
require "socket"
puts "Connecting to IRC..."
irc = TCPSocket.open('irc.freenode.net', 6667)
irc.send("USER blah blah blah :blah blah\n", 0)
irc.send("NICK ChanScanBot\n", 0)
puts "Joining #sproutcore"
@justinko
justinko / gist:773952
Created January 11, 2011 03:05
Create an HTML table in Ruby
html = "".tap do |str|
str << '<table>'
str << '<tr>'
str << '<td>'
str << 'a'
str << '</td>'
str << '<td>'
str << 'b'
str << '</td>'
str << '</tr>'
@JoshCheek
JoshCheek / stack.rb
Created July 23, 2011 13:53
The stack from my Pry screencast
# The stack I wrote for http://vimeo.com/26391171
# Note that there is an intentional bug in the each method :)
class Stack
Node = Struct.new :data, :next
def push(data)
@head = Node.new data, @head
end
@cdmwebs
cdmwebs / friendly_urls.markdown
Created September 11, 2011 15:50 — forked from jcasimir/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.

@agnellvj
agnellvj / friendly_urls.markdown
Created September 11, 2011 15:52 — forked from jcasimir/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.