Skip to content

Instantly share code, notes, and snippets.

View angelsystem's full-sized avatar

angel roberto angelsystem

View GitHub Profile
@angelsystem
angelsystem / lock.swift
Created December 12, 2017 15:51
function que bloquea la vista si la version no es la minima
func showBlockerViewByVersionIfNeeded() {
if let version = Bundle.main.releaseVersionNumber {
let verifyAppURL = WURL.verifyAppVersion!+"?version=\(version)"+"&os=ios"
_ = Server.instance.request(method: .get, URLString: verifyAppURL, response: { (result) in
switch result {
case .success(let value):
print("value: \(value)")
class Participante
attr_accessor :nombre, :edad, :dni, :cinturon, :partidaGanada, :partidaEmpatada, :partidaPerdida, :puntajeTotal
def initialize args
args.each do |k,v|
instance_variable_set("@#{k}", v) unless v.nil?
end
@puntajeTotal = puntaje_total
end
import UIKit
import PureLayout
class EmptyBackgroundView: UIView {
private var topSpace: UIView!
private var bottomSpace: UIView!
private var imageView: UIImageView!
private var topLabel: UILabel!
private var bottomLabel: UILabel!
def thumbnail
raise ActionController::RoutingError.new('Not Found') unless @file.thumbnail?
if stale?(@file, public: true, template: false)
send_file(@file.thumbnail_path, disposition: 'inline', type: 'image/png', filename: thumbnail_filename)
end
end
module Thumbnailable
extend ActiveSupport::Concern
def thumbnail_original
raise NotImplementedError
end
def thumbnail_path
return unless thumbnail?
a {
colour: brand-colour(blue);
&:hover {
colour: brand-colour(blue, dark);
}
}
require 'rails_helper'
RSpec.describe 'creating_seller_profile', type: :feature do
context 'create a new seller profile', js: true do
let!(:seller) { create(:seller) }
before do
log_in_as_seller(seller)
end
it 'should create a seller profile' do
visit new_seller_seller_profile_path(seller)
@angelsystem
angelsystem / sumar.rb
Created November 7, 2014 01:34
demo suma
class SumarDigitos
def sumar_numbers(number)
sum = 0
number.to_s.each_char do |n|
sum = sum + (n.to_i)
end
sum
end
@angelsystem
angelsystem / ViewController.swift
Created November 5, 2014 04:55
keyboard hide button return
import UIKit
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet var password: UITextField! //create a delegate in storyboard with viewcontroller and textfield
func textFieldShouldReturn(textField: UITextField) -> Bool {
password.resignFirstResponder()
return true
}
@angelsystem
angelsystem / ViewController.swift
Created November 5, 2014 04:51
keyboard hide touch screen
import UIKit
class ViewController: UIViewController {
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
self.view.endEditing(true)
}