blah | ||
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 'nokogiri' | |
require 'open-uri' | |
# Get a Nokogiri::HTML:Document for the page we're interested in... | |
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove')) | |
# Do funky things with it using Nokogiri::XML::Node methods... | |
#### |
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 'nokogiri' | |
html = ' | |
<html> | |
<body> | |
<p>foo banana 1</p> | |
this text | |
<p>bar</p> | |
<p>foo banana 2</p> | |
<p>foo banana 3</p> |
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
import UIKit | |
class FloatingButtonController: UIViewController { | |
private(set) var button: UIButton! | |
required init?(coder aDecoder: NSCoder) { | |
fatalError() | |
} |
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
import SwiftUI | |
struct ContentView: View, MyProtocol { | |
@State var text: String = "My Text" | |
var body: some View { | |
NavigationView { | |
VStack { | |
Text(text) | |
NavigationLink(destination: SecondView(delegate: self)) { | |
Text("2nd View") |
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
import UIKit | |
extension UIImage { | |
subscript (x: Int, y: Int) -> UIColor? { | |
guard x >= 0 && x < Int(size.width) && y >= 0 && y < Int(size.height), | |
let cgImage = cgImage, | |
let provider = cgImage.dataProvider, | |
let providerData = provider.data, | |
let data = CFDataGetBytePtr(providerData) else { | |
return nil |
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
import Foundation | |
extension Character { | |
var isEmoji: Bool { | |
return unicodeScalars.allSatisfy { $0.properties.isEmoji } | |
} | |
} | |
func recentlyUsedEmoji() -> [Character]? { | |
#if os(iOS) |
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
// | |
// SpriteSheet.swift | |
// MyGame | |
// | |
// Created by Ramires Moreira on 14/03/19. | |
// Copyright © 2019 Ramires Moreira. All rights reserved. | |
// | |
import SpriteKit |
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
let altitude = distance*tan(M_PI*(75.0/180.0)) |
NewerOlder