Skip to content

Instantly share code, notes, and snippets.

View eyeplum's full-sized avatar
👀
U+1F440 EYES

Yan Li eyeplum

👀
U+1F440 EYES
  • Auckland, New Zealand
View GitHub Profile
@eyeplum
eyeplum / drawRect.swift
Created March 7, 2016 16:15
Simple command to draw a rect.
/*
Tested on OS X 10.11 and Ubuntu 15.10
Exmaple: `$ drawRect 4 3` should output this:
┌──┐
│ │
└──┘
*/
// MARK: - Data Structures
@eyeplum
eyeplum / Dockerfile
Last active March 7, 2016 17:05
Dockerfile for building latest Open Source Swift container
FROM ubuntu:15.10
# Latest Swift Development Snapshot
ENV SWIFT_BRANCH development
ENV SWIFT_VERSION swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a
ENV SWIFT_PLATFORM ubuntu15.10
# Install Dependencies
RUN apt-get update && \
apt-get install -y \
@eyeplum
eyeplum / GIF-Screencast-OSX.md
Created December 8, 2015 08:24 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@eyeplum
eyeplum / lumiere.rs
Last active October 19, 2015 09:21
A talk about WWDC15 at Liulishuo House-warming Party
// Trying to build a Rust version here
extern crate rustc_serialize;
use std::io;
use std::env;
use std::path::Path;
use std::fs::File;
use std::io::Read;
use std::vec;
@eyeplum
eyeplum / rycooder.swift
Last active August 29, 2015 14:13
RyCooder - Command Line Music Player written in Swift
import Foundation
import AVFoundation
// AudioPlayer Class Definition
class AudioPlayer: NSObject {
private let runLoop: NSRunLoop = NSRunLoop.currentRunLoop()
private let stdinHandle: NSFileHandle = NSFileHandle.fileHandleWithStandardInput()
private let items: [AVPlayerItem]!
private var queuePlayer: AVQueuePlayer!
@eyeplum
eyeplum / CVDisplayLink
Last active December 20, 2015 17:59
CVDisplayLink based animator example.
@eyeplum
eyeplum / my_attributed_text_view.rb
Created August 29, 2012 03:21
A hack to use DTAttributedTextContentView for multiple column text.
class MYAttributedTextView <DTAttributedTextContentView
def layoutFrame
layout_frame = super
rect = layout_frame.frame
rect = UIEdgeInsetsInsetRect(self.bounds, edgeInsets)
new_frame = DTCoreTextLayoutFrame.alloc.initWithFrame(rect, layouter:self.layouter)
new_frame
end
end