Skip to content

Instantly share code, notes, and snippets.

@csabahenk
Last active September 5, 2016 06:06

Revisions

  1. csabahenk revised this gist Sep 2, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion desuspendtab.rb
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,7 @@
    }
    increment = checkopt[%w[-i --increment]]
    breaknl = checkopt[%w[-b --break]]
    checklist = checkopt[%w[-c --checklist]]

    puts $<.read.strip.gsub(%r@chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#url=(.*)@) {
    CGI.unescape $1
    @@ -15,5 +16,5 @@
    if !x and l=~/\Ahttps?:/
    e="[#{t}](#{l})"
    end
    "#{increment ? i+1 : 1}. #{e}"
    "#{checklist ? "- [ ]" : "#{increment ? i+1 : 1}."} #{e}"
    }.join("\n" * (breaknl ? 2 : 1))
  2. csabahenk revised this gist Jan 27, 2015. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions desuspendtab.rb
    Original file line number Diff line number Diff line change
    @@ -2,12 +2,18 @@

    require 'cgi'

    checkopt = proc { |a|
    !a.flatten.map { |o| $*.delete o }.compact.empty?
    }
    increment = checkopt[%w[-i --increment]]
    breaknl = checkopt[%w[-b --break]]

    puts $<.read.strip.gsub(%r@chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#url=(.*)@) {
    CGI.unescape $1
    }.split("\n\n").map.with_index { |e, i|
    t,l,x=e.split("\n")
    if !x and l=~/\Ahttps?:/
    e="[#{t}](#{l})"
    end
    "#{i+1}. #{e}"
    }.join("\n\n")
    "#{increment ? i+1 : 1}. #{e}"
    }.join("\n" * (breaknl ? 2 : 1))
  3. csabahenk revised this gist Jan 27, 2015. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion desuspendtab.rb
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,10 @@

    puts $<.read.strip.gsub(%r@chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#url=(.*)@) {
    CGI.unescape $1
    }.split("\n\n").map.with_index { |e, i| "#{i+1}. #{e}" }.join("\n\n")
    }.split("\n\n").map.with_index { |e, i|
    t,l,x=e.split("\n")
    if !x and l=~/\Ahttps?:/
    e="[#{t}](#{l})"
    end
    "#{i+1}. #{e}"
    }.join("\n\n")
  4. csabahenk created this gist Dec 10, 2014.
    7 changes: 7 additions & 0 deletions desuspendtab.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    #!/usr/bin/env ruby

    require 'cgi'

    puts $<.read.strip.gsub(%r@chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#url=(.*)@) {
    CGI.unescape $1
    }.split("\n\n").map.with_index { |e, i| "#{i+1}. #{e}" }.join("\n\n")