This file contains hidden or 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
| require "rubygems" | |
| require "prawn" | |
| require "prawn/measurement_extensions" | |
| Prawn::Document.generate("badge_printing.pdf", :margin_top => 0.5.in) do | |
| # our start_x position for the columns | |
| [0.5, 4].each do |column_width| | |
| # spacing between each "badge" |
This file contains hidden or 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
| javascript:(function(){var%20x,n,nD,z,i;%20function%20htmlEscape(s){s=s.replace(/&/g,'&');s=s.replace(/>/g,'>');s=s.replace(/</g,'<');return%20s;}%20function%20attrQuoteEscape(s){s=s.replace(/&/g,'&');%20s=s.replace(/"/g,%20'"');return%20s;}%20x="tinyurl.com";%20n=0;%20if(x!=null)%20{%20x=x.toLowerCase();%20nD%20=%20window.open().document;%20nD.writeln('<html><head><title>Links%20containing%20"'+htmlEscape(x)+'"</title><base%20target="_blank"></head><body>');%20nD.writeln('Links%20on%20<a%20href="'+attrQuoteEscape(location.href)+'">'+htmlEscape(location.href)+'</a><br>%20with%20link%20text%20or%20target%20url%20containing%20"'%20+%20htmlEscape(x)%20+%20'"<br><hr>');%20z%20=%20document.links;%20for%20(i%20=%200;%20i%20<%20z.length;%20++i)%20{%20if%20((z[i].innerHTML%20&&%20z[i].innerHTML.toLowerCase().indexOf(x)%20!=%20-1)%20||%20z[i].href.toLowerCase().indexOf(x)%20!=%20-1%20)%20{%20nD.writeln(++n%20+%20'.%20<a%20href="'%20+%20attrQuoteEscape(z[i].href)%20+%20'">'%20+%20(z[i].inne |
This file contains hidden or 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
| class PushIt | |
| def initialize | |
| @whatsits = [] | |
| end | |
| def <<(*args) | |
| @whatsits << args | |
| end |
This file contains hidden or 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
| require 'rubygems' | |
| require 'appscript' | |
| include Appscript | |
| ab = app("Address Book") | |
| group_name = "Missing Phone Numbers" | |
| if ab.groups['Missing Phone Numbers'].eq(:missing_value) |
This file contains hidden or 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
| tell application "Address Book" | |
| make new group with properties {name:"No Phone Numbers"} | |
| repeat with i from 1 to number of items in people | |
| set thePerson to item i of people | |
| if properties of phones of (thePerson) is {} then | |
| add thePerson to group "No Phone Numbers" |
This file contains hidden or 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
| require 'rubygems' | |
| require 'eventmachine' | |
| class RedisClient < EventMachine::Connection | |
| include EM::Protocols::LineText2 | |
| include EM::Deferrable | |
| unless defined? Rcrlf | |
| Rcrlf = "\r\n".freeze |
This file contains hidden or 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
| jetpack.tabs.onReady(function onNextPage(doc) { | |
| if (!doc.defaultView.frameElement) { | |
| doc.addEventListener('DOMNodeInserted',function(e){ | |
| jetpack.notifications.show("Inserted node containing:" + jQuery(e.target).text()); | |
| }, true); | |
| jetpack.notifications.show("Loaded " + doc.location.href); | |
| //jetpack.tabs.onReady.unbind(onNextPage); | |
| } |
This file contains hidden or 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
| wesmaldonado:~/workspace/logging-redis-appender$ irb | |
| >> require 'lib/logging-redis-appender' #=> true | |
| >> ra = Logging::Appenders::Redis.new #=> Appenders::Redis:0x2de4d4 name"redis" | |
| >> ra2 = Logging::Appenders::Redis.new('floogle') #=> Appenders::Redis:0x2d70da name"floogle" | |
| >> r = Logging.logger.root #=> Logging::RootLogger:0x2d0e6a name"root" | |
| >> r.add_appenders(ra,ra2) #=> Logging::RootLogger:0x2d0e6a name"root" | |
| >> r.info "bloogle" #=> true | |
| >> ra.read #=> [" INFO root : bloogle\n"] | |
| >> ra2.read #=> [" INFO root : bloogle\n"] | |
| >> r = Redis.new #=> #<Redis:0x55b43c @password=nil, @port=6379, @sock=#<TCPSocket:0x55b39c>, timeout5, db0, host"127.0.0.1" |
This file contains hidden or 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
| >> class OpenStruct | |
| >> attr_accessor :id | |
| >> end | |
| => nil | |
| >> os = OpenStruct.new(:id => 1) | |
| => #<OpenStruct id=1> | |
| >> os.id | |
| => nil | |
| >> os.id = -1 | |
| => -1 |
This file contains hidden or 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 page_name_defined?( ad_position, options ) | |
| return false if !options.include?( "admin_page_name" ) | |
| apn = options.fetch( "admin_page_name" ) | |
| if options.include?("brand") | |
| bnd = options.fetch("brand") | |
| begin | |
| return $ad_placements["BRANDS"].fetch(bnd).include?(apn) | |
| rescue | |
| return false | |
| end |
OlderNewer