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
| @implementation UITextView (Annex) | |
| @dynamic visibleTextRange; | |
| - (NSRange)visibleTextRange | |
| { | |
| CGRect bounds = self.bounds; | |
| CGSize textSize = [self.text sizeWithFont:self.font constrainedToSize:bounds.size]; | |
| UITextPosition *start = [self characterRangeAtPoint:bounds.origin].start; |
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
| guard 'shell' do | |
| watch(/relation_tree_spec\.rb/) { `clear && ruby relation_tree_spec.rb` } | |
| 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
| #! /bin/sh | |
| # ================================================================== | |
| # ______ __ _____ | |
| # /_ __/___ ____ ___ _________ _/ /_ /__ / | |
| # / / / __ \/ __ `__ \/ ___/ __ `/ __/ / / | |
| # / / / /_/ / / / / / / /__/ /_/ / /_ / / | |
| #/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/ | |
| # Multi-instance Apache Tomcat installation with a focus | |
| # on best-practices as defined by Apache, SpringSource, and MuleSoft |
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
| if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { | |
| UIGraphicsBeginImageContextWithOptions(_site.bounds.size, NO, [UIScreen mainScreen].scale); | |
| } else { | |
| UIGraphicsBeginImageContext(_site.frame.size); | |
| } | |
| [_site.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
| UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); |
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
| static inline BOOL IsEmpty(id thing) { | |
| return thing == nil | |
| || thing == [NSNull null] | |
| || ([thing respondsToSelector:@selector(length)] | |
| && [(NSData *)thing length] == 0) | |
| || ([thing respondsToSelector:@selector(count)] | |
| && [(NSArray *)thing count] == 0); | |
| } |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>name</key> | |
| <string>Monokai Bright</string> | |
| <key>settings</key> | |
| <array> | |
| <dict> | |
| <key>settings</key> |
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
| # Install rvm system-wide | |
| bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer ) | |
| # Update the packages | |
| apt-get update | |
| apt-get upgrade | |
| apt-get install build-essential | |
| # get the packages required by ruby | |
| rvm pkg install zlib |
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 Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |
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 'net/http' | |
| require "rexml/document" | |
| require "rexml/xpath" | |
| puts "RESULTADOS GOBERNACION ELECCIONES DE PUERTO RICO\n---------------------\n\n" | |
| loop do | |
| doc = REXML::Document.new(Net::HTTP.get_response(URI('http://div1.ceepur.org/REYDI_NocheDelEvento/data/GOBERNADOR_ISLA.xml')).body) | |
| puts "#{Time.now.strftime("%B %d, %Y %H:%I:%S %p")}\n\n" | |
| resultados = doc.elements.collect('/default/option') { |e| { name: REXML::XPath.first(e,'name/es').text, party:REXML::XPath.first(e,'pe/es').text, votes: REXML::XPath.first(e,'votes').text.to_i } } | |
| resultados.each {|r| puts "#{r[:name]} (#{r[:party]}) => #{r[:votes].to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, "\\1,").reverse} (#{sprintf("%.2f", (r[:votes].to_f / resultados.inject(0) { |sum, r| sum + r[:votes] }.to_f) * 100)}%)"} | |
| sleep(10) |
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
| #!/usr/bin/env ruby | |
| # You should run `gem install httparty` first | |
| require 'httparty' | |
| def comma_numbers(number, delimiter = ',') | |
| number.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, "\\1#{delimiter}").reverse | |
| end |