Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry session
Debugger
/* basic usage */ | |
ViewGroup root = (ViewGroup) findViewById(android.R.id.content); | |
LayoutTraverser.build(new LayoutTraverser.Processor() { | |
@Override | |
public void process(View view) { | |
// do stuff with the view | |
} | |
}).traverse(root); |
Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry sessionDebugger
extension UIImage { | |
func invertedImage() -> UIImage? { | |
let img = CoreImage.CIImage(CGImage: self.CGImage) | |
let filter = CIFilter(name: "CIColorInvert") | |
filter.setDefaults() | |
filter.setValue(img, forKey: "inputImage") |
let twoDimArr: [[Int]] = [[0, 0, 1], [1, 0, 1]] | |
for (i,row) in twoDimArr.enumerate() { | |
for (j, cell) in row.enumerate() { | |
print("m[\(i),\(j)] = \(cell)") | |
print("**************") | |
} | |
} |
private static func createUserEventData(user:SKUser, eventType:SKEventType, sticker:Sticker?) { | |
// server endpoint | |
let endpoint = "https://app.stickerkit.io/userEvent/v1/\(user.projectID)" | |
guard let endpointUrl = URL(string: endpoint) else { | |
return nil | |
} | |
//Make JSON to send to send to server |
import RealmSwift | |
import Realm | |
protocol CascadeDeleting: class { | |
func delete<Entity>(_ list: List<Entity>, cascading: Bool) | |
func delete<Entity>(_ results: Results<Entity>, cascading: Bool) | |
func delete<Entity: Object>(_ entity: Entity, cascading: Bool) | |
} |
#!/bin/bash | |
# Script to disable the iOS Simulator app from showing the "Do you want the application xxxx to accept incoming network connections?" pop-up every time the app is run | |
echo "> Enter password to temporarily shut firewall off" | |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off | |
echo "> Add Xcode as a firewall exception" | |
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/MacOS/Xcode |
public class Network:NSObject, URLSessionDelegate, URLSessionTaskDelegate, URLSessionDataDelegate { | |
internal static let sharedInstance = Network() | |
fileprivate var networkParams:Array<NetworkParams> = Array() | |
fileprivate func networkCall(_ request:URLRequest, completionBlock:@escaping NetworkCompletionBlock) | |
{ | |
let configurationId = String(format: "Network%d", arc4random()) | |
let configuration = URLSessionConfiguration.background(withIdentifier: configurationId) | |
configuration.timeoutIntervalForRequest = request.timeoutInterval |
#!/usr/bin/env bash | |
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error | |
# Make sure that the .gnupg directory and its contents is accessibile by your user. | |
chown -R $(whoami) ~/.gnupg/ | |
# Also correct the permissions and access rights on the directory | |
chmod 600 ~/.gnupg/* | |
chmod 700 ~/.gnupg |