Skip to content

Instantly share code, notes, and snippets.

View modsaid's full-sized avatar

Mahmoud Salem modsaid

View GitHub Profile
@tansengming
tansengming / Rails Console Actionmailer test.rb
Created April 24, 2009 15:14
Rails Console Actionmailer test
# Copy and paste this to the rails console to test your email settings
class MyMailer < ActionMailer::Base
def test_email
@recipients = "someone@somewhere.com"
@from = "must_be_same_as_smpt_account_login@gmail.com"
@subject = "test from the Rails Console"
@body = "This is a test email"
end
end
@huyng
huyng / reflect.py
Created February 7, 2011 17:57
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@shyam
shyam / compile-ruby-1.9.x-on-linux.sh
Created September 22, 2011 06:49
Installing Ruby 1.9.x from source on Linux ( Debian/Ubuntu and RHEL/CentOS )
# Note: This script show how to compile ruby-1.9.2-p290. It can also be used for 1.9.3-p0 or higher versions.
#
# Dependencies
#
# Debian and derivatives:
# aptitude install build-essential libssl-dev libcurl4-openssl-dev libreadline5-dev zlib1g-dev libxslt1-dev libxml2-dev
@rsvp
rsvp / netspeed.sh
Last active May 13, 2020 15:08
netspeed.sh : check download speed rate via command line | Linux bash script
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2013-07-11
#
# _______________| netspeed : check download speed via command line.
#
# Usage: netspeed [tokyo, london, usw, use, east, west, URL]
# ^default U.S. west coast.
# [ -speed_KB/sec ]
# ^negation activates the Mbps converter.
#
@samqiu
samqiu / railscasts.rb
Last active December 9, 2022 03:49
Download free Railscast video
#!/usr/bin/ruby
require 'rss'
# Usage
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/
# episodes.rss
# OR
# $ ./railscasts.rb
p 'Downloading rss index'
@postmodern
postmodern / bump_copyright.rb
Created January 3, 2012 02:18
Automatically bump the year in the Copyright-notice headers of Ruby files.
@seanlinsley
seanlinsley / gist:2038003
Last active June 7, 2019 08:00
A better form to edit multiple child records. Created for https://github.com/gregbell/active_admin/issues/1097
<%= semantic_form_for @parent do |a| %>
<%= a.inputs "Family Details" do %>
<%= a.input :name %>
<%= a.input :user %>
<%= a.input :region %>
<% end %>
<%= a.inputs "Children" do %>
<table>
@amir20
amir20 / to_csv.rb
Created March 15, 2012 01:10
Converts YAML to CSV
#!/usr/bin/ruby
if ARGV.size.zero?
puts %Q[
Usage:
./to_csv.rb file.yml > out.csv
]
exit
end
@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active April 15, 2024 14:27
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@madtrick
madtrick / remote_authenticatable.rb
Created October 19, 2012 08:43
Example module to perform remote authentication with Devise
module Devise
module Models
module RemoteAuthenticatable
extend ActiveSupport::Concern
#
# Here you do the request to the external webservice
#
# If the authentication is successful you should return
# a resource instance