Skip to content

Instantly share code, notes, and snippets.

View muizidn's full-sized avatar
👨‍🚀
Working between Tiangong and Mir

Former Not Wannabe Lord Paramount of the Wkwkland muizidn

👨‍🚀
Working between Tiangong and Mir
  • Indian Ocean
View GitHub Profile
@muizidn
muizidn / helloWorld.swift
Created August 30, 2017 23:50
Simple Hello World in Swift
print( "Hello World" )
@muizidn
muizidn / helloWorld.cs
Created August 30, 2017 23:54
Simple Hello World in C#
using System;
class Program {
static void Main() {
Console.Writeline( "Hello World" );
}
}
@muizidn
muizidn / gist:d0098d8573027a47372b9828321295a5
Created September 30, 2017 06:04 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
var gajah: Gajah? = nil
// Membuat custom queue
let barrierQueue = DispatchQueue(label: "concurrentBarrierQueue", attribute : .concurrent)
// Mengisi / Writing
barrierQueue.async(flags: .barrier) {
gajah = Gajah()
}
@muizidn
muizidn / ABCViewControllerMock.swift
Created November 28, 2017 10:29
Saya ingin membuat subclass Mock untuk ABCViewController namun selalu error saat runtime. SIGNAL SIGBART
// Di kode produksi ABCApp
class ABCViewController: UIViewController {
func foo() -> String {
return "Jalankan kode PRODUKSI untuk ABCViewController"
}
}
// Di ViewControllerTests
@muizidn
muizidn / SearchController+FilteredResult.swift
Created December 6, 2017 10:18
This can be used to make search controller in header of tableView
// UIViewController class conforms UISearchResultUpdating
// MARK: Search Controller
func configureSearchController() {
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
definesPresentationContext = true
tableView.tableHeaderView = searchController.searchBar
}
@muizidn
muizidn / ExportErrorToFile.js
Last active December 9, 2017 02:12
This can be used to export any error log automatically to a text file. Feel free to use for your project!
// SWIFT 4.0.1
// XCODE 9.0.1
#if DEBUG
var errorFile = "errorLog.txt"
// Error object must be conform to CustomStringConvertible protocol
func saveErrorLog<T: CustomStringConvertible>(error: T) {
// Fetch document directory URL
let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let path = documentDirectory.appendingPathComponent(errorFile).path
protocol PertarunganCivilWar {
func diSerang()
}
class CaptainAmericaViewController: UIViewController, PertarunganCivilWar {
diSerang()
}
class IronManViewController: UIViewController, PertarunganCivilWar {
diSerang()
@muizidn
muizidn / PropertyStoring.swift
Created December 21, 2017 03:14
A declaration which used when user wants to put stored property in extension
protocol PropertyStoring {
func getAssociatedObject<T>(_ key: UnsafeRawPointer, defaultValue: T) -> T
}
extension PropertyStoring {
func getAssociatedObject<T>(_ key: UnsafeRawPointer, defaultValue: T) -> T {
guard let value = objc_getAssociatedObject(self, key) as? T else {
return defaultValue
}
return value
}
# Make folder <folder>.python
mkdir SomeFolder.python; cd SomeFolder.python
# Make VirtualEnv
virtualenv -p $(which python3) .venv
# Activate
source .venv/bin/activate