Skip to content

Instantly share code, notes, and snippets.

View ahikmatf's full-sized avatar
💭
Learning how to code

Asep Hikmat Fatahillah ahikmatf

💭
Learning how to code
View GitHub Profile
@ahikmatf
ahikmatf / baca
Last active November 4, 2016 06:42
GCD http://swiftable.io/2016/06/dispatch-queues-swift-3/
PullToRefresh https://grokswift.com/pull-to-refresh-swift-table-view/
ColorScheme https://color.adobe.com/create/color-wheel/
CocoaRandomRead https://littlebitesofcocoa.com/random?cb=1478241403
//http://stackoverflow.com/a/29617215/5552518
let circlePath = UIBezierPath(arcCenter: CGPoint(x: 100,y: 100), radius: CGFloat(20), startAngle: CGFloat(0), endAngle:CGFloat(M_PI * 2), clockwise: true)
let shapeLayer = CAShapeLayer()
shapeLayer.path = circlePath.cgPath
//change the fill color
shapeLayer.fillColor = UIColor.clear.cgColor
// http://stackoverflow.com/a/30022852/5552518
let btn1 = UIButton(type: .custom)
btn1.setImage(UIImage(named: "imagename"), for: .normal)
btn1.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
btn1.addTarget(self, action: #selector(Class.Methodname), for: .touchUpInside)
let item1 = UIBarButtonItem(customView: btn1)
let btn2 = UIButton(type: .custom)
// https://inteist.com/git-remove-pods-folder-from-pushed-repository-how-to/
git filter-branch --index-filter 'git rm --cached --ignore-unmatch Pods/*' --tag-name-filter cat -- --all
git push --force
@ahikmatf
ahikmatf / gist:e9e4840712804d4688b1a40f120c0c69
Created January 17, 2017 02:32 — forked from ttran4040/gist:74a07380af8c76d1b3d4
Check for Internet Connection (Swift)
import Foundation
import SystemConfiguration
public class Reachability {
class func isConnectedToNetwork() -> Bool {
var zeroAddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0))
zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))
zeroAddress.sin_family = sa_family_t(AF_INET)
// http://stackoverflow.com/a/41176030/5552518
//
// ConnectionHandler.swift
// iDIP
//
// Created by Mac on 1/17/17.
// Copyright © 2017 Fatahillah. All rights reserved.
//
@ahikmatf
ahikmatf / localize.swift
Created February 28, 2017 03:45 — forked from Maxdw/localize.swift
genstrings for custom translation function
extension String {
func localizedWith(comment:String) -> String {
return NSLocalizedString(self, tableName: nil, bundle: Bundle.main, value: "", comment: comment)
}
}
echo | openssl s_client -connect <your-server-here>:443 2>/dev/null | openssl x509 -noout -dates
https://hackernoon.com/the-practical-guide-for-building-rest-api-in-nodejs-and-mongodb-include-passport-and-jwt-476720b70da0
const devConfig = {};
const testConfig = {};
const prodConfig = {};
const defaultConfig = {
PORT: process.env.PORT || 3000,
};
function envConfig(env) {
switch (env) {
@ahikmatf
ahikmatf / rsa 256
Created January 2, 2019 03:44
generate public and private key
# generate private key
openssl genrsa -out private.pem 2048
# extatract public key from it
openssl rsa -in private.pem -pubout > public.pem