Skip to content

Instantly share code, notes, and snippets.

View Demircivi's full-sized avatar
🏠
Working from home

Doğu Emre Demirçivi Demircivi

🏠
Working from home
View GitHub Profile
@hinzundcode
hinzundcode / gist:2ca9b9a425b8ed0d9ec4
Created May 29, 2015 14:00
NSImage to base64 encoded data url
var path: NSString = NSWorkspace.sharedWorkspace().absolutePathForAppBundleWithIdentifier("com.apple.dt.xcode")!
var icon: NSImage = NSWorkspace.sharedWorkspace().iconForFile(path)
var data: NSData = icon.TIFFRepresentation!
var bitmap: NSBitmapImageRep = NSBitmapImageRep(data: data)!
data = bitmap.representationUsingType(NSBitmapImageFileType.NSPNGFileType, properties: [:])!
var base64: NSString = "data:image/png;base64," + data.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.allZeros)
println(base64)
@waldobronchart
waldobronchart / UnityPlatformSwitcher.cs
Last active February 5, 2025 00:51
A simple fast platform switcher for Unity
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.IO;
public class PlatformSwitcher
{
[MenuItem("Platform/PC, Mac and Linux Standalone")]
static void SwitchPlatformToDesktop()
{
@sam-artuso
sam-artuso / setting-up-babel-nodemon.md
Last active March 30, 2025 10:24
Setting up Babel and nodemon

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y
@darrensapalo
darrensapalo / Limiting simultaneous downloads using RxAlamofire
Created November 11, 2016 06:41
Separate your code to make it more readable. It makes it easier to debug as well.
import RxSwift
example ("Helping Sebastian Roth") {
let disposeBag = DisposeBag()
// Data model representing the current download progress
struct DownloadProgress {
var numberOfCompletedDownloads: Int
var progress: Float
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 29, 2025 15:57
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@lattner
lattner / async_swift_proposal.md
Last active December 28, 2024 11:11 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@meetkabeershah
meetkabeershah / default nginx configuration file
Last active January 11, 2025 12:19
The default nginx configuration file inside /etc/nginx/sites-available/default
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#