Skip to content

Instantly share code, notes, and snippets.

@syxc
syxc / closeAppElegantly.swift
Created July 12, 2022 01:31 — forked from yoni-g/closeAppElegantly.swift
How to exit an iOS app without it looking like a crash? - Swift
func showMessageResetApp(){
let exitAppAlert = UIAlertController(title: "Restart is needed",
message: "We need to restart the app on your first login to the app.\n Please reopen the app after this.",
preferredStyle: .alert)
let resetApp = UIAlertAction(title: "Close Now", style: .destructive) {
(alert) -> Void in
// home button pressed programmatically - to thorw app to background
UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)
// terminaing app in background
@syxc
syxc / closeAppElegantly.swift
Created July 12, 2022 01:31 — forked from yoni-g/closeAppElegantly.swift
How to exit an iOS app without it looking like a crash? - Swift
func showMessageResetApp(){
let exitAppAlert = UIAlertController(title: "Restart is needed",
message: "We need to restart the app on your first login to the app.\n Please reopen the app after this.",
preferredStyle: .alert)
let resetApp = UIAlertAction(title: "Close Now", style: .destructive) {
(alert) -> Void in
// home button pressed programmatically - to thorw app to background
UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)
// terminaing app in background
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw
LjI4OTQ5OTEzMzggMC4zMTMzNjE2NzQ1IDAuMzYzNjI3ODIxMgAQAoAC0hAREhNaJGNs
YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.36362782120704651</real>
@syxc
syxc / squirrel.custom.lite.yaml
Last active January 2, 2019 19:19
鼠鬚管配色、默认配置备忘
patch:
show_notifications_when: appropriate # 状态通知,适当,也可设为全开(always)全关(never)
# style:
# color_scheme: purity_of_essence
# horizontal: true
# inline_preedit: true
# candidate_format: "%c\u2005%@\u2005" # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间。
# font_point: 16 # 候选文字大小
# label_font_point: 14 # 候选编号大小
@syxc
syxc / .editorconfig
Created January 8, 2016 06:46
My EditorConfig
# http://editorconfig.org
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
max_line_length = 80
@syxc
syxc / ToggleButton.h
Last active October 31, 2015 12:51
简单的开关按钮实现
//
// ToggleButton.h
// FaceDemo
//
// Created by syxc on 15/10/31.
// Copyright © 2015年 syxc. All rights reserved.
//
#import <UIKit/UIKit.h>
@syxc
syxc / QQFacePanel.m
Created October 31, 2015 10:56
一个布局的例子,类似 QQ 表情面板
//
// ViewController.m
// FaceDemo
//
// Created by syxc on 15/10/31.
// Copyright © 2015年 syxc. All rights reserved.
//
#import "ViewController.h"
@syxc
syxc / Base64Coder.java
Created July 24, 2015 09:58
RSA encrypt/decrypt function (RSA / ECB / PKCS1-Padding)
//Copyright 2003-2009 Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland
//www.source-code.biz, www.inventec.ch/chdh
//
//This module is multi-licensed and may be used under the terms
//of any of the following licenses:
//
//EPL, Eclipse Public License, http://www.eclipse.org/legal
//LGPL, GNU Lesser General Public License, http://www.gnu.org/licenses/lgpl.html
//AL, Apache License, http://www.apache.org/licenses
//BSD, BSD License, http://www.opensource.org/licenses/bsd-license.php
@syxc
syxc / SimpleXOR.php
Created July 10, 2015 10:06
SimpleXOR for PHP
<?php
/**
* Created by PhpStorm.
* User: syxc
* Date: 15/7/10
* Time: 17:29
*/
class SimpleXOR
{