Skip to content

Instantly share code, notes, and snippets.

View seanho's full-sized avatar

Sean Ho seanho

View GitHub Profile
<rule name="Rewrite subdomain" stopProcessing="false">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(?!www)(\w+)\.domain\.net$" />
</conditions>
<action type="Rewrite" url="{C:1}/{R:1}" />
</rule>
web = HtmlAgilityPack::HtmlWeb.new
doc = web.Load 'http://hk.news.yahoo.com/hongkong/index.html'
node = doc.DocumentNode.SelectSingleNode '/html/body/div/div[2]/div/div/div/div/div/div/div[2]'
node.ChildNodes.each do |n|
output.WriteLine n.InnerText
end
#output.WriteLine doc.DocumentNode.InnerHtml
using System;
using System.IO;
using System.Reflection;
using IronRuby;
using Microsoft.Scripting.Hosting;
namespace IronRubyConsole
{
class Program
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="microsoft.scripting" type="Microsoft.Scripting.Hosting.Configuration.Section, Microsoft.Scripting, Version=0.9.6.20, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
</configSections>
<microsoft.scripting>
<languages>
<language names="IronRuby;Ruby;rb" extensions=".rb" displayName="IronRuby 0.9.3"
type="IronRuby.Runtime.RubyContext, IronRuby, Version=0.9.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</languages>
<?php
if ($_GET['type'] == 'archive')
{
try
{
$db = new PDO("sqlite:talkonly.sqlite");
$sql = "SELECT * FROM play_items ORDER BY list_id DESC, item_id ASC";
$json_output = array();
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-color: #FCF8E0;
margin-left: 10px;
NSString *url = @"http://brandontreb.com";
NSString *apiEndpoint = [NSString stringWithFormat:@"http://api.tr.im/v1/trim_simple?url=%@",url];
NSString *shortURL = [NSString stringWithContentsOfURL:[NSURL URLWithString:apiEndpoint]
encoding:NSASCIIStringEncoding
error:nil];
NSLog(@"Long: %@ - Short: %@",url,shortURL);
// Outputs Long: http://brandontreb.com - Short: http://tr.im/MRDd
using System;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using HtmlAgilityPack;
namespace EmbedHtml
{
public class Embeder
{
@seanho
seanho / test.md
Created July 3, 2013 07:49
Test Edit

Test