I hereby claim:
- I am spnkr on github.
- I am willjessop (https://keybase.io/willjessop) on keybase.
- I have a public key ASBc9HbuOaYcw6McQU4go0Uo7hsSZWAM8WN9doVRuv2DEwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// Basically, these are if and else statements respectively | |
// without the opposite clause | |
func when(_ test: @autoclosure () -> Bool, action: () -> ()) { | |
if test() { action() } | |
} | |
func unless(_ test: @autoclosure () -> Bool, action: () -> ()) { | |
if !test() { action() } | |
} |
import Foundation | |
import UIKit | |
extension UIColor { | |
convenience init(hexString:String) { | |
let hexString:NSString = hexString.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) | |
let scanner = NSScanner(string: hexString) | |
if (hexString.hasPrefix("#")) { | |
scanner.scanLocation = 1 |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
_ = coreDataStack.mainContext | |
self.window = UIWindow(frame: UIScreen.main.bounds) | |
let loadingViewController = LoadingViewController() | |
loadingViewController.coreDataStack = coreDataStack | |
self.window?.rootViewController = loadingViewController | |
self.window?.makeKeyAndVisible() | |
app.window = self.window | |
return true | |
} |
<%# Put this code snippet between the <head></head>-tags in your application layout and %> | |
<%# replace 'UA-XXXXXXXX-X' with your own unique Google Analytics Tracking ID %> | |
<%# ... %> | |
<head> | |
<%# ... %> | |
<% if Rails.env.production? %> | |
<script type="text/javascript"> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
class _PSN | |
include HTTParty | |
attr_accessor :oauth, :error, :npsso, :grant_code, :refresh_token, | |
:email, :password, :ticket_uuid, :code | |
ACTIVITY_URL = "https://activity.api.np.km.playstation.net/activity/api/v1/users/" | |
OAUTH_URL = "https://auth.api.sonyentertainmentnetwork.com/2.0/oauth/token" | |
SSO_URL = "https://auth.api.sonyentertainmentnetwork.com/2.0/ssocookie" | |
CODE_URL = "https://auth.api.sonyentertainmentnetwork.com/2.0/oauth/authorize" |
#sometimes when you try to import a json file to firebase via the console, firebase says "invalid keys" (If you create your own keys, they must be UTF-8 encoded, can be a maximum of 768 bytes, and cannot contain ., $, #, [, ], /, or ASCII control characters 0-31 or 127.) This script will print out the invalid keys so you can manually fix them. | |
#useful if you have a giant firebase json file not generated from another db. | |
#Caveat: quick and dirty, only goes a few levels deep. theoretically you could use recursion to go n-levels deep, but I didn't need this for my use case. | |
#Caveat: doesn't check for utf-8 encoding, or ASCII control characters 0-31 and 127. | |
require 'json' |
Each YouTube video has 4 generated images. They are predictably formatted as follows: | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg | |
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is: | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg |
Each YouTube video has 4 generated images. They are predictably formatted as follows: | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg | |
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is: | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg |
# frozen_string_literal: false | |
# | |
# irb/context.rb - irb context | |
# $Release Version: 0.9.6$ | |
# $Revision$ | |
# by Keiju ISHITSUKA([email protected]) | |
# | |
# -- | |
# | |
# |