Skip to content

Instantly share code, notes, and snippets.

@conscientiousness
conscientiousness / tableViewCellWithXib
Last active December 7, 2015 15:09
dequeueReusableCellWithIdentifier
//=====(1)=====
@interface ViewController ()<UITableViewDataSource,UITableViewDelegate>
{
UINib * nib;
}
@end
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (nib == nil) {

誠徵:iOS開發人員(發佈日期:2016/07/25)

Imgur

職位:全職(Remote)

  • 職務: iOS Developer

責任:協助我們打造東南亞及亞太地區最棒的新聞應用程式!

// in self class -> MyVC
myBtn.addTarget(self, action: .selfSelector, forControlEvents: .TouchUpInside)
// in singleton class -> mainVC
mainVCBtn.addTarget(SingletonClass.shared().mainVC, action: .addTopicSelector, forControlEvents: .TouchUpInside)
private extension Selector {
static let selfSelector = #selector(MyVC.btnDidPressed(_:))
static let addTopicSelector = #selector(SingletonClass.shared().mainVC.newTopicBtnPressed(_:))
@conscientiousness
conscientiousness / gist:95ce3d8c04d82c2169e2bd2ba0e9b7a9
Created August 12, 2016 08:50
Get IndexPath from cell button
CGPoint center= sender.center;
CGPoint rootViewPoint = [sender.superview convertPoint:center toView:self.myTableView];
NSIndexPath *indexPath = [self.myTableView indexPathForRowAtPoint:rootViewPoint];
@conscientiousness
conscientiousness / gist:2aaec91df4b5be00abecac1fbbd7d6c4
Created September 6, 2016 16:42
Using apple script to open Xcode and do something
tell application "Xcode"
activate
end tell
delay 1
tell application "System Events"
tell process "Xcode"
tell menu bar 1
tell menu bar item 10
tell menu 1
tell menu item 12
desc "Deploy a new version to the App Store"
lane :release do
# 1.Creating Certificates and Provisioning Profiles
cert
sigh(force: true)
# 2.
#ensure_git_status_clean
# 3.Creating the IPA file
sudo su
apt-get update
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get install htop -y
apt-get install unattended-upgrades -y && dpkg-reconfigure -plow unattended-upgrades
apt-get install ntp -y && ntpq -p && service ntp restart
reboot
@conscientiousness
conscientiousness / gist:a98e1ca3ea2d72fe78186f6371c84f87
Created August 7, 2017 08:41
blog-install-vapor-and-swift-bash
eval "$(curl -sL https://apt.vapor.sh)"
sudo apt-get install swift vapor
sudo apt-get install libpq-devcd
server {
server_name YOUR_DOMAIN_NAME;
listen 80 default_server;
listen [::]:80 default_server;
root /home/YOUR_VAPOR_FOLDER_PATH/Public;
index index.html;
try_files $uri @proxy;
location @proxy {
[program:APP_NAME]
command=vapor run --env=production
directory=/home/USER_NAME/YOUR_APP/ # Put correct path here
autorestart=true
user=USER_NAME # Put username here
stdout_logfile=/var/log/supervisor/%(program_name)-stdout.log
stderr_logfile=/var/log/supervisor/%(program_name)-stderr.log