Skip to content

Instantly share code, notes, and snippets.

View eliakorkmaz's full-sized avatar
🎯
Focusing

Emrah Korkmaz eliakorkmaz

🎯
Focusing
View GitHub Profile
@daehli
daehli / VSCODE.md
Created December 18, 2017 19:51
Install Visual Studio Code on Mac OS and add vscode alias

Brew Install

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null

Install Brew Visual-Studio Code

brew cask install visual-studio-code
@KrisYu
KrisYu / saveImage.swift
Last active July 3, 2022 11:55
Save image to file on macOS using swift, answers found from SO
// plain write to image
@discardableResult func writeCGImage(_ image: CGImage, to destinationURL: URL) -> Bool {
guard let destination = CGImageDestinationCreateWithURL(destinationURL as CFURL, kUTTypePNG, 1, nil) else { return false }
CGImageDestinationAddImage(destination, image, nil)
return CGImageDestinationFinalize(destination)
}
// There's a panel, save image png
@zkat
zkat / index.js
Last active September 26, 2024 10:33
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@TheCodedSelf
TheCodedSelf / RxSwiftBindToButton.swift
Created May 13, 2017 17:16
RxSwift: Bind to button taps
import UIKit
import RxSwift
import RxCocoa
let button = UIButton()
button.rx.tap.bind {
print("button tapped")
}
@candostdagdeviren
candostdagdeviren / .swiftlint.yml
Last active September 15, 2024 19:51
Sample SwiftLint file to apply best practices
disabled_rules: # rule identifiers to exclude from running
- variable_name
- nesting
- function_parameter_count
opt_in_rules: # some rules are only opt-in
- control_statement
- empty_count
- trailing_newline
- colon
- comma
@samwarnick
samwarnick / UIRoundedButtonWithGradientAndShadow.swift
Last active December 26, 2021 16:45
A rounded button with a gradient and shadow written in swift
class UIRoundedButtonWithGradientAndShadow: UIButton {
let gradientColors : [UIColor]
let startPoint : CGPoint
let endPoint : CGPoint
required init(gradientColors: [UIColor],
startPoint: CGPoint = CGPoint(x: 0, y: 0.5),
endPoint: CGPoint = CGPoint(x: 1, y: 0.5)) {
self.gradientColors = gradientColors
@subfuzion
subfuzion / curl.md
Last active November 17, 2024 03:54
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ccabanero
ccabanero / how-to-create-a-cocoa-pod
Last active April 1, 2023 04:43
How to Create a Cocoa Pod
Notes for Creating a Cocoa Pod
Pod Version: 0.39.0
OS: OS X El Capitain (10.11.3)
- - - - - - - - - - - - - - - - - - - - - - -
1. Install CocoaPods (https://guides.cocoapods.org/using/getting-started.html)
2. Create Xcode project to author the Pod
@gonzalezreal
gonzalezreal / ios-cell-registration-swift.md
Last active March 13, 2024 15:18
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
@manjeshpv
manjeshpv / Apple Push Notification APNS PHP Snippet.php
Last active May 24, 2023 22:56
Apple Push Notification APNS PHP Snippet - Server Side Implementation
<?php
$deviceToken = '6e1326c0e4758b54332fab3b3cb2f9ed92e2cd332e9ba8182f49027054b64d29'; // iPad 5s Gold prod
$passphrase = '';
$message = 'Hello Push Notification';
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'pushcert.pem'); // Pem file to generated // openssl pkcs12 -in pushcert.p12 -out pushcert.pem -nodes -clcerts // .p12 private key generated from Apple Developer Account
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); // production
// $fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); // developement