My Recent Pastes (634 and counting)

Pastes by Allan Odgaard (634 and counting)

Pages:

Below are the 15 most recent pasties by Allan Odgaard.

July 18, 2007
1:35PM EDT
by Allan Odgaard

require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb'

options = {
  :title   => "Tidy Warnings",
  :summary => "Warnings for tidying your document:",

July 18, 2007
11:56AM EDT
by Allan Odgaard

APP_PATH=$(ps -xwwp $PPID -o command|grep -o '.*.app')
ORIGIFS="$IFS"
IFS=$'\n\b'
INDEX=0
Y=(top center bottom)

July 18, 2007
11:51AM EDT
by Allan Odgaard

APP_PATH=$(ps -xwwp $PPID -o command|grep -o '.*.app')
ORIGIFS="$IFS"
IFS=$'\n\b'
Y_POS=10
for line in $(</tmp/tm_tidy_errors); do

July 18, 2007
9:49AM EDT
by Allan Odgaard

# CyBot Goners plugin
--- 
allan: !ruby/struct:Goner 
  nick: allan
  channel: "##textmate"

July 17, 2007
6:32PM EDT
by Allan Odgaard

JEG2: as for the shell book, I think there are 3 common “concepts” where a better understanding would help the user.

These are 1) command line arguments (understanding what the shell parser does and what the program (shell command) sees), common problems here is how to give a newline, give a string containing both a " and ', etc.

2) file descriptors (pipes), the stdin/out are generally understood, but that these are just fd 0 and 1 are rarely fully understood, this in relation to redirection, e.g. how you can send data to an arbitrary file descriptor via a here-doc, here-string, from running another command etc. (not just via |) — useful e.g. when you want to do things like use a here-doc for a program that also needs to read from stdin, when you want to avoid temporary files (e.g. a command only takes a file as argument) etc.

July 17, 2007
8:58AM EDT
by Allan Odgaard

Index: /Users/duff/Library/Application Support/TextMate/Bundles/SQL.tmbundle/Support/bin/db_browser.rb
===================================================================
--- /Users/duff/Library/Application Support/TextMate/Bundles/SQL.tmbundle/Support/bin/db_browser.rb        (revision 7751)
+++ /Users/duff/Library/Application Support/TextMate/Bundles/SQL.tmbundle/Support/bin/db_browser.rb        (working copy)
@@ -3,6 +3,7 @@

July 17, 2007
8:51AM EDT
by Allan Odgaard

Index: SQL.tmbundle/Support/bin/db_browser.rb
===================================================================
--- SQL.tmbundle/Support/bin/db_browser.rb        (revision 7751)
+++ SQL.tmbundle/Support/bin/db_browser.rb        (working copy)
@@ -134,6 +134,7 @@

July 16, 2007
6:50PM EDT
by Allan Odgaard

                //  1. If there is just one text area, we use that.
                // 
                //  2. If there are multiple, we ask the web view to “select all”
                //     which goes to the active text area (hopefully) and then we
                //     check which of the text areas in the DOM actually changed.

July 07, 2007
11:40AM EDT
by Allan Odgaard

<% fewkfmekwf # bjannre %>
kewfmkwemf

July 06, 2007
11:52AM EDT
by Allan Odgaard

        if @seen.has_key?("#cybot_test")
          corrections = @seen["#cybot_test"].keys.inject({}) do |hash, name|
            distance = edit_distance(nick, name).to_f
            hash[name] = distance if distance <= (nick.size + name.size.to_f) / 2.0 * 0.70
            hash

July 06, 2007
3:18AM EDT
by Allan Odgaard

class Country
{
        function Country($country_code) {
                $this->country_code = $country_code;
        }

July 06, 2007
3:16AM EDT
by Allan Odgaard

function binary_search($fp, $min, $max, $ip) {
        if($min == $max)
                return false;

        $middle = floor(($min+$max) / 2);

July 04, 2007
7:16AM EDT
by Allan Odgaard

The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.

The requested resource resides temporarily under a different URI. Since the redirection MAY be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.


July 03, 2007
11:06AM EDT
by Allan Odgaard

require 'scanf'
require "benchmark"

str = "1 1 a\n" * 10000

July 03, 2007
10:54AM EDT
by Allan Odgaard

                        begin = '(?x)
                           (?:
                             ^                      # beginning of line
                           | (?<=                   # or look-behind on:
                               [=>~(?:\[,|&]

Next page

Previous page