Skip to content

Instantly share code, notes, and snippets.

View phynet's full-sized avatar
🤘
I said yeah.

Sofia Swidarowicz phynet

🤘
I said yeah.
View GitHub Profile
@phynet
phynet / deviceToken.m
Last active May 27, 2017 13:51
Get iOS device token for push notification
NSString *token = [[deviceToken description] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"<>"]];
token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];
NSLog(@"Device Token %@: ", token);
NSDate *animationStart = [NSDate date];
NSTimeInterval pendingTime = MAX(2 - [[NSDate date] timeIntervalSinceDate:animationStart], 0);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(pendingTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//call a method .... do something
});
//DISPATCH_TIME_NOW is a constant declared in dispatch class from iOS 9
@murarisumit
murarisumit / remoteExcutePoweshell
Created March 5, 2015 20:11
Remotely execute powershell script
#Script that will be invoked when invoke-command will be executed
$script = [scriptblock]::create("get-host
hostname")
$node = "1.12.3.4"
#UserName that will deploy it
$username = "username"
$pw = "password"
@phynet
phynet / Jenkins Mac OS X configuration.md
Last active June 4, 2022 16:27
Jenkins Mac OS X configuration

Jenkins Mac OS X configuration

First, copy the plist file from (take note, that the number 1,590 may vary in each machine)

/usr/local/Cellar/jenkins/1.590

to LaunchAgent folder:

cp /usr/local/Cellar/jenkins/1.590/homebrew.mxcl.jenkins.plist /Users/medianet/Library/LaunchAgents 
@s-aska
s-aska / Keychain.swift
Last active September 16, 2022 03:37
Swift Keychain class ( supported Xcode 6.0.1 )
import UIKit
import Security
class Keychain {
class func save(key: String, data: NSData) -> Bool {
let query = [
kSecClass as String : kSecClassGenericPassword as String,
kSecAttrAccount as String : key,
kSecValueData as String : data ]
@jernejstrasner
jernejstrasner / HMACDigest.swift
Last active May 4, 2020 14:54
HMAC digest in Swift
// Make sure you add #import <CommonCrypto/CommonCrypto.h> to the Xcode bridging header!
enum CryptoAlgorithm {
case MD5, SHA1, SHA224, SHA256, SHA384, SHA512
var HMACAlgorithm: CCHmacAlgorithm {
var result: Int = 0
switch self {
case .MD5: result = kCCHmacAlgMD5
case .SHA1: result = kCCHmacAlgSHA1
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active May 23, 2024 12:17
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@Inferis
Inferis / ViewController.swift
Last active December 1, 2019 23:27
Beginnings of a GCD wrapper in swift
import UIKit
import QuartzCore
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel
@IBOutlet weak var counter: UILabel
override func viewDidLoad() {
super.viewDidLoad()
@kautaleksei
kautaleksei / gist:19afe866371bf3168a3d
Last active July 5, 2020 13:24 — forked from anonymous/gist:5356982
Objective-C fastes method for get min and max value from array.
#import <Foundation/Foundation.h>
void method1(NSArray *numbers)
{
NSArray *sorted = [numbers sortedArrayUsingSelector:@selector(compare:)];
}
void method2(NSArray *numbers)
{
NSNumber *max=[numbers valueForKeyPath:@"@max.doubleValue"];