Skip to content

Instantly share code, notes, and snippets.

View talhasyed's full-sized avatar

Talha Umer Syed talhasyed

View GitHub Profile
[user]
name = talha
email = [email protected]
[alias]
co = checkout
st = status
[editor]
editor = mate
[apply]
whitespace = nowarn
# CocoaMySQL dump
# Version 0.7b4
# http://cocoamysql.sourceforge.net
#
# Host: localhost (MySQL 5.0.37)
# Database: slideshow
# Generation Time: 2009-01-28 12:04:41 -0500
# ************************************************************
# Dump of table sidebar_modules
# CocoaMySQL dump
# Version 0.7b4
# http://cocoamysql.sourceforge.net
#
# Host: localhost (MySQL 5.0.37)
# Database: slideshow
# Generation Time: 2009-01-28 13:04:19 -0500
# ************************************************************
# Dump of table slides
@talhasyed
talhasyed / tps.rb
Created January 29, 2009 15:25
tps report generator
require 'rubygems'
gem 'hpricot'
require 'hpricot'
require 'date'
Author = 'talha'
Svns = {
:local => "svn+ssh://svn.bubbleshare.com/svn/local/",
:bluedash => "svn+ssh://svn.bubbleshare.com/svn/admin/",
:csp => "svn+ssh://svn.bubbleshare.com/svn/csp/",
require 'csv'
file = "db/commission_junction/2087028_18584_20080827.csv"
cols, *rows = CSV::Reader.parse(File.open(file)).to_a
collection = rows.collect { |row| Hash[*cols.zip(row).flatten] }
puts collection.first.inspect
What I want:
<head>
...
<!-- the content of the partial -->
</head>
<body>
...
</body>
==============
require 'rubygems'
gem 'nokogiri'
require 'nokogiri'
require 'open-uri'
require 'pp'
urls = [
"http://www.kaboose.com/speed_test.html",
"http://parenting.kaboose.com/index_speed_test.html",
### API ###
# LyrisMember
# SelectMember(email, list)
"http://lyris-servis.kaboose.com/[email protected]&list=kaboose_crafts" # [lyris_member, ...]
# EmailOnWhatLists(email)
"http://lyris-servis.kaboose.com/users/12345/lists" # returns [newsletter.to_xml, ...]
# CreateSingleMember(email, name, list)
"http://lyris-servis.kaboose.com/users" # POST request with list name, demographics etc
@talhasyed
talhasyed / k_means_clustering.rb
Created March 19, 2010 20:39
Just trying out K-Means Clustering by following a blog post about it
require 'pp'
def k_means_cluster(clusters=[[]])
# pp clusters
clusters_with_centroids = clusters.inject({}) do |centroids, cluster|
cluster_centroid = (cluster.inject(0.0) {|item, sum| sum+=item})/cluster.size
centroids[cluster_centroid] = cluster
centroids
defaults write com.macromates.textmate OakDefaultLanguage E00B62AC-6B1C-11D9-9B1F-000D93589AF6