Skip to content

Instantly share code, notes, and snippets.

View dabing1022's full-sized avatar
👨‍💻
Focusing

ChildhoodAndy dabing1022

👨‍💻
Focusing
View GitHub Profile
@gabe565
gabe565 / change-arc-icon.md
Last active July 22, 2024 05:39
Change Arc Browser Icon

Change Arc Browser Icon

arc

A collection of commands that change the Arc Browser icon on macOS.

Commands

Theme Command
Candy Arc defaults write company.thebrowser.Browser currentAppIconName candy
import Foundation
import CoreFoundation
public final class CoreNotificationCenter {
public static let darwin = CoreNotificationCenter(CFNotificationCenterGetDarwinNotifyCenter())
public static let local = CoreNotificationCenter(CFNotificationCenterGetLocalCenter())
#if os(macOS)
public static let distributed = CoreNotificationCenter(CFNotificationCenterGetDistributedCenter())
@nikias
nikias / limd-build-macos.sh
Last active July 3, 2024 21:11
Build libimobiledevice stack for macOS with ease
#!/bin/bash
# If you like this script and my work on libimobiledevice, please
# consider becoming a patron at https://patreon.com/nikias - Thanks <3
REV=1.0.17
if test "`echo -e Test`" != "Test" 2>&1; then
echo Please run this with zsh or bash.
exit 1
@zhaozzq
zhaozzq / inject.markdown
Last active March 30, 2021 12:39
Inject js to WKWebView
WKWebViewConfiguration *configuration = [WKWebViewConfiguration new];
NSString *eruda = @"(function () { var script = document.createElement('script'); script.src='//cdn.jsdelivr.net/npm/eruda'; document.body.appendChild(script); script.onload = function () { eruda.init() } })();";
WKUserScript *script = [[WKUserScript alloc] initWithSource:eruda injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:NO];
[configuration.userContentController addUserScript:script];
_webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration];

or

NSString *jsPath = [[NSBundle mainBundle] pathForResource:@"vConsole" ofType:@"js"];
@junyixin
junyixin / lock.m
Last active October 13, 2023 10:12
iOS锁屏通知(Objective-C)
//回调
static void displayStatusChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
// "com.apple.springboard.lockcomplete" 通知总是接在 "com.apple.springboard.lockstate" 通知后面
CFStringRef nameCFString = (CFStringRef)name;
NSString *lockState = (__bridge NSString*)nameCFString;
NSLog(@"Darwin notification NAME = %@",name);
if([lockState isEqualToString:@"com.apple.springboard.lockcomplete"]) {
NSLog(@"锁屏");
} else {
@dabing1022
dabing1022 / GetDeviceInfo.mm
Last active May 22, 2022 06:57
IOS_GET_DEVICE_INFO
NSLog(@"HostName: %@", [[NSProcessInfo processInfo] hostName]);
//globallyUniqueString 唯一的标示符,每次调用都会不一样,可以用作一些临时缓存文件的名字
NSLog(@"GlobalUniqueString: %@", [[NSProcessInfo processInfo] globallyUniqueString]);
//操作系统名称
NSLog(@"OperatingSystemName: %@", [[NSProcessInfo processInfo] operatingSystemName]);
//操作系统版本
NSLog(@"OperatingSystemVersion: %@", [[NSProcessInfo processInfo] operatingSystemVersionString]);
//物理内存
NSLog(@"PhysicalMem: %llu", [[NSProcessInfo processInfo] physicalMemory]);
//进程名称
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"More" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
// maybe show an action sheet with more options
[self.tableView setEditing:NO];
}];
moreAction.backgroundColor = [UIColor lightGrayColor];
UITableViewRowAction *blurAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Blur" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
[self.tableView setEditing:NO];
}];
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
#import "CCSprite.h"
@interface SoftBubble : CCSprite
@end
@lzubiaur
lzubiaur / notification.lua
Last active March 24, 2018 12:34
Lua Notification Center (cocos2dx)
--[[
Why this package?
Cocos2d-x CCNotificationCenter is limited to one lua function callback (observer) per target (CCObject).
This simple Lua script wraps CCNotificationCenter and allows code like:
addObserver(foo,'eventname')
addObserver(foo2,'eventname')
]]--
-- The NotificationCenter (nc) table
local nc = {