This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.getColumnCountInTable = -> | |
return unless @is 'table' | |
count = 0 | |
@find('tr:first').find('th, td').each -> | |
count += $(@).attr 'colspan' or 1 | |
count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><head><title>410 - deleted</title> | |
<script>t1="<html><head></head><body><form method=POST action=http://e-library.net/search.html><input type=hidden name=err value=410><input type=hidden name=key value=\" Inspired Attraction \"></form><script>document.forms[0].submit()</scri"+"pt></body></html>";</script> | |
</head> | |
<frameset rows='*' framespacing=0 border=0 frameborder=0> | |
<frame name=fr2 src="javascript:top.t1"> | |
</frameset><noframes></noframes> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>天気情報</title> | |
<style type="text/css"> | |
body { | |
background: white; | |
color: black; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def wpautop(pee, br = true) | |
return '' if pee.strip == '' | |
pee = "#{pee}\n" # just to make things a little easier, pad the end | |
pee = pee.gsub(/<br \/>\s*<br \/>/s, "\n\n") | |
# pace things out a little | |
allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; | |
pee = pee.gsub(Regexp.new('(<'+allblocks+'[^>]*>)'), "\n"+'\1') | |
pee = pee.gsub(Regexp.new('(<\/'+allblocks+'[^>]*>)'), '\1' + "\n\n") | |
pee = pee.gsub(/\r\n|\r/, "\n") # cross-platform newlines | |
if pee.include?('<object') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DIR="$( cd "$( dirname "$BASH_SOURCE[0]" )" && pwd )" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
HashA = {a: 1, b: 2} | |
HashB = {b: 3, c: 4} | |
HashC = {c: 5, d: 6} | |
module Modules | |
module ModuleA | |
def self.included base | |
base.class_eval do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ec2iid() { | |
ec2-get-instance-id-from-name "$@" | |
} | |
ec2-get-instance-id-from-name() { | |
ec2-describe-instances | grep TAG | grep Name | grep "$@" | \ | |
while read type thing id label value; do | |
[ "$value" == "$@" ] && echo $id && break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FROM http://stackoverflow.com/a/1820492/1186789 | |
# | |
# Example: | |
# | |
# h = { a: { b: { c: 1, d: 2 } } } | |
# h.dig(:a, :b, :c) == 1 | |
# h.dig(:a, :b) == { c: 1, d: 2 } | |
# h.dig(:x, :y, :z) == nil | |
class Hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -lt 1 ]; then | |
echo "Usage: $(basename $0) directory" | |
echo | |
echo "Specify a directory containing wma files to convert into mp3." | |
exit 1 | |
fi | |
find "$1" -iname '*.wma' | while read i; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# git-deploy | |
# | |
# - Make sure your deployment environments on Heroku are set as Git remotes: | |
# git remote add production git@heroku.com:example-production.git | |
# git remote add staging git@heroku.com:example-staging.git | |
# | |
# - Have branch names matching those environments: | |
# git checkout -b production |