Skip to content

Instantly share code, notes, and snippets.

View JustinZelus's full-sized avatar
:octocat:

JZ JustinZelus

:octocat:
  • Taiwan
View GitHub Profile
@JustinZelus
JustinZelus / .Cloud.md
Created January 22, 2025 04:07 — forked from imba-tjd/.Cloud.md
☁️ 一些免费的云资源

  • IaaS指提供系统(可以自己选)或者储存空间之类的硬件,软件要自己手动装。PaaS提供语言环境和框架(可以自己选)。SaaS只能使用开发好的软件(卖软件本身,如税务会计、表格文字处理)。BaaS一般类似于非关系数据库,但各家不通用
  • 云服务的特点:零前期成本 & 按需付费 & 弹性(类似于租,可随时多加、退掉;但没有残值)、高可用(放在机房中,不同AZ间水电隔离)

其他人的集合

@JustinZelus
JustinZelus / async_swift_proposal.md
Created November 23, 2023 04:43 — forked from lattner/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.

@JustinZelus
JustinZelus / Note.md
Last active February 8, 2021 03:18
筆記

[個人筆記]後台IMEI表格快速按,程式崩潰問題
上下快速按,約N次後,畫面不再顯示資料。Debug後發現以下錯誤訊息:
[中文訊息]
已超過連接逾時的設定。在取得集區連接之前超過逾時等待的時間,可能的原因為所有的共用連接已在使用中,並已達共用集區大小的最大值。
[發生原因]
每一次的Row select將會call兩支api,最終造成DB連線次數超過
查看資料庫連線次數發現停在101次
[參考資源]
https://dotblogs.com.tw/eason/2011/12/15/62290

@JustinZelus
JustinZelus / 1-README.md
Created December 25, 2019 08:33 — forked from lopspower/1-README.md
Android M Permissions

Android M Permissions

Twitter

1) Android Permissions

Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app. This approach streamlines the app install process, since the user does not need to grant permissions when they install or update the app. It also gives the user more control over the app's functionality; for example, a user could choose to give a camera app access to the camera but not to the device location. The user can revoke the permissions at any time, by going to the app's Settings screen.

Normal and Dangerous Permissions

@JustinZelus
JustinZelus / Permission.java
Created December 25, 2019 08:31 — forked from droibit/Permission.java
Helper class for runtime permission of Android M
import android.Manifest;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.annotation.NonNull;
@JustinZelus
JustinZelus / Foo.swift
Created September 20, 2019 02:22 — forked from matsuda/Foo.swift
Realm utilities
import RealmSwift
final class Foo: Object {
dynamic var code: String = UUID().uuidString
dynamic var timestamp: Date = Date()
override static func primaryKey() -> String? {
return "code"
}
@JustinZelus
JustinZelus / UserInfoCell.swift
Created May 30, 2019 01:41 — forked from mats-claassen/UserInfoCell.swift
Example of an Eureka custom row
//
// UserInfoCell.swift
//
// Created by Mathias Claassen on 30/8/16.
// Copyright © 2016 Xmartlabs. All rights reserved.
//
import Foundation
import Eureka
@JustinZelus
JustinZelus / AppDelegate.swift
Created April 30, 2019 01:13 — forked from andreif/AppDelegate.swift
Example of UIPageViewController inside UIPageViewController created without storyboard i.e. programmatically
// derived from hhttps://gist.github.com/andreif/ba209f4749d590406562
import UIKit
struct Page {
var title: String
var image: String
}

Restarting Your Node.js App at Reboot

Cronjob can prevent your application and your users from unexpected downtimes.

Create a file called starter.sh in your application's home folder and copy the following code:

#!/bin/sh

if [ $(ps -e -o uid,cmd | grep $UID | grep node | grep -v grep | wc -l | tr -s "\n") -eq 0 ]
@JustinZelus
JustinZelus / app.js
Created January 7, 2019 07:55
My React Todo App
//const TASKS = {task:"Initial Task", completed:true};
class TodoApp extends React.Component {
constructor(props){
super(props);
this.changeTask = this.changeTask.bind(this);
this.addTask = this.addTask.bind(this);
this.changeViewByFilter = this.changeViewByFilter.bind(this);
this.removeTask = this.removeTask.bind(this);
this.state={
tasks:[], filter: 'all'