adb logcat | grep `adb shell ps | grep com.package | cut -c10-15`
- Split sentence preserve punctuation
https://stackoverflow.com/a/15687656/2096740
Use scan
(throw strip in there to get rid of trailing spaces).
s = "I am a lion. Hear me roar! Where is my cub? Never mind, found him."
s.scan(/[^\.!?]+[\.!?]/).map(&:strip) # => ["I am a lion.", "Hear me roar!", "Where is my cub?", "Never mind, found him."]
- Simple detect puncutation in string
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
var Client = require('./upnp_client.js') | |
var client = new Client('http://192.168.1.6:49152/description.xml'); | |
console.log(client); | |
// Get the device description | |
client.getDeviceDescription(function(err, description) { | |
if(err) throw err; | |
console.log("starting device description module") | |
console.log(description); |
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/env python | |
# Read requests from HTTP methods GET, POST, PUT, DELETE, NOTIFY or any other custom method | |
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
from optparse import OptionParser | |
class RequestHandler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
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
# space150 vine-to-GIF | |
# given a vine.co uri, downloads the MP4 and creates an image sequence / GIF from it | |
# requires ruby, ffmpeg, and imagemagick | |
require 'open-uri' | |
require 'nokogiri' | |
id = ARGV[0] | |
# try to convert from URL to id. |
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
# USAGE: Hash.from_xml(YOUR_XML_STRING)require 'rubygems' | |
require 'nokogiri' | |
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#123129 | |
7 | |
class Hash | |
class << self | |
def from_xml(xml_io) | |
begin | |
result = Nokogiri::XML(xml_io) |
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
require './xmldsl' | |
Twitter = Struct.new :name, :avatar, :text | |
twitters = [] | |
5.times { twitters << Twitter.new("Jonas", "/profile.png", "Hello World!") } | |
xml = XML.generate do | |
html do | |
body do | |
twitters.each do |tw| |
Run test_glade.rb
Run basic.rb