Skip to content

Instantly share code, notes, and snippets.

View cactis's full-sized avatar

chitsung.lin cactis

View GitHub Profile
@cactis
cactis / setup.sh
Last active December 16, 2015 19:39 — forked from mrsweaters/setup.sh
#!/usr/bin/env bash
# login as root and run this script via bash & curl:
apt-get update
apt-get install -y build-essential bison openssl libreadline5 libreadline-dev curl \
git-core zlib1g zlib1g-dev libopenssl-ruby libcurl4-openssl-dev libssl-dev \
libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libmysqlclient-dev \
mysql-client mysql-server
#!/usr/bin/env bash
# login as root and run this script via bash & curl:
apt-get update
apt-get install -y build-essential bison openssl libreadline5 libreadline-dev curl \
git-core zlib1g zlib1g-dev libopenssl-ruby libcurl4-openssl-dev libssl-dev \
libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libmysqlclient-dev \
libyaml-dev libxslt1-dev autoconf libgdbm-dev libncurses5-dev automake libtool libffi-dev \
mysql-client mysql-server
@cactis
cactis / mail.rb
Created March 19, 2014 08:03
added attachment option to enable BW::Mail to support sendAttachmentData
module BubbleWrap
module Mail
module_function
# Base method to create your in-app mail
# ---------------------------------------
# EX
# BW::Mail.compose {
# delegate: self, # optional, will use root view controller by default
//Here's the same thing in Objective-C
#import "WebView.h"
@implementation WebView
@synthesize webView = _webView;
-(void) viewDidLoad
{
//Here's the same thing in Objective-C
#import "WebView.h"
@implementation WebView
@synthesize webView = _webView;
-(void) viewDidLoad
{
@cactis
cactis / sliding_transition.rb
Created April 19, 2014 04:46
How to do a sliding transition in RubyMotion?
def viewDidLoad
view.image = UIImage.imageNamed('welcome.png')
view.userInteractionEnabled = true
recognizer = UITapGestureRecognizer.alloc.initWithTarget(self, action:'nextScreen')
view.addGestureRecognizer(recognizer)
end
def nextScreen
animation = CATransition.animation
# A simple example of creating a UIView with a UICollectionView as a subview
# in RubyMotion using Teacup for styling
#
# Your controller will need to set the stylesheet: stylesheet :example
# and create this view like so: subview Example, :my_example_view
class Example < UIView
CELL_IDENTIFIER = 'example_cell'
def initWithFrame(frame)
@cactis
cactis / Rakefile
Created August 17, 2014 12:15 — forked from chareice/Rakefile
app.info_plist['UIStatusBarStyle'] = 'UIStatusBarStyleBlackTranslucent'
app.info_plist["UIViewControllerBasedStatusBarAppearance"] = false
extension NSAttributedString {
func replaceHTMLTag(tag: String, withAttributes attributes: [String: AnyObject]) -> NSAttributedString {
let openTag = "<\(tag)>"
let closeTag = "</\(tag)>"
let resultingText: NSMutableAttributedString = self.mutableCopy() as NSMutableAttributedString
while true {
let plainString = resultingText.string as NSString
let openTagRange = plainString.rangeOfString(openTag)
if openTagRange.length == 0 {
@cactis
cactis / gist:ef464037a9a39a1afdd7
Last active August 29, 2015 14:28
about dynamic height of custom cell
//
// IssuesTableViewController.swift
// imuc
//
// Created by ctslin on 2015/8/4.
// Copyright (c) 2015年 ctslin. All rights reserved.
//
import UIKit