Skip to content

Instantly share code, notes, and snippets.

View cyndibaby905's full-sized avatar

Fred Chen cyndibaby905

  • ByteDance
  • Beijing, China
View GitHub Profile
@cyndibaby905
cyndibaby905 / SmartPointer.h
Last active November 27, 2015 07:48
A standard smart pointer
//
// SmartPointer.h
// MemoryDemo
//
// Created by HangChen on 5/5/15.
// Copyright (c) 2015 HangChen. All rights reserved.
//
#ifndef __MemoryDemo__SmartPointer__
#define __MemoryDemo__SmartPointer__
@azenla
azenla / event_loop.dart
Last active March 11, 2022 01:21
Simulation of the Dart Event Loop in Dart.
/// Dart is built around a timer, which basically schedules functions in a queue.
/// The Future class is essentially just sugar on top of the event loop.
/// To help people understand what the event loop actually does, I have written code which implements the event loop.
/// See https://www.dartlang.org/articles/event-loop/ for more information.
import "dart:async";
class EventLoop {
/// Function Queue.
static final List<Function> queue = [];
@noamtm
noamtm / parse_ipa.py
Last active August 18, 2022 14:23
Python: Parse Info.plist from IPA on OSX
#!/usr/bin/env python
from Foundation import NSData, NSPropertyListSerialization
import fnmatch
import sys
from zipfile import ZipFile
# TODO: Add error checking.
def parse_plist(info_plist_string):
@bang590
bang590 / linkmap.js
Last active August 19, 2023 15:24
XCode Linkmap Parser
var readline = require('readline'),
fs = require('fs');
var LinkMap = function(filePath) {
this.files = []
this.filePath = filePath
}
LinkMap.prototype = {
start: function(cb) {
@jspahrsummers
jspahrsummers / GHRunLoopWatchdog.h
Created January 28, 2015 20:50
A class for logging excessive blocking on the main thread
/// Observes a run loop to detect any stalling or blocking that occurs.
///
/// This class is thread-safe.
@interface GHRunLoopWatchdog : NSObject
/// Initializes the receiver to watch the specified run loop, using a default
/// stalling threshold.
- (id)initWithRunLoop:(CFRunLoopRef)runLoop;
/// Initializes the receiver to detect when the specified run loop blocks for
@onevcat
onevcat / orientation-in-framework.m
Created October 28, 2014 02:43
Swizzle to solve Landscape mode in a Portrait app. Can be used in third party framework. If you are working on an app, you can only modify the app delegate to achieve it.
#pragma mark - Magic
// Need for supporting orientation when not supported in host app plist.
// Swizzle original -application:supportedInterfaceOrientationsForWindow: to change supported orientation in runtime.
-(void) swizzleSupportedInterfaceOrientationsForWindow
{
Class applicationDelegateClass = [[UIApplication sharedApplication].delegate class];
Class sdkClass = [self class];
SEL originalSelector = @selector(application:supportedInterfaceOrientationsForWindow:);
SEL swizzledSelector = @selector(las_application:supportedInterfaceOrientationsForWindow:);
@lexrus
lexrus / WTF_YOU_MUST_UPGRADE_COCOAPODS.sh
Created May 28, 2014 10:34
Force your little brother to upgrade CocoaPods.
NEW_VER="0.33.1"
POD_VER=`pod --version 2>/dev/null`|| POD_VER=`~/.rbenv/shims/pod --version 2>/dev/null`
if [[ "$POD_VER" != *$NEW_VER ]]; then
echo "error: WTF! You MUST upgrade cocoapods!!!"
exit 1
fi
@cyndibaby905
cyndibaby905 / NSNUll+ InternalNullExtention.m
Created March 28, 2014 09:23
NSNUll+ InternalNullExtention.m
#define NSNullObjects @[@"",@0,@{},@[]]
@interface NSNull (InternalNullExtention)
@end
@implementation NSNull (InternalNullExtention)
@imcaspar
imcaspar / mmcat.sh
Created February 3, 2014 02:17
mmcat.sh
#!/bin/bash
################################################################################
#
# Script name: MultiMedia Concat Script (mmcat)
# Author: burek (burek021@gmail.com)
# License: GNU/GPL, see http://www.gnu.org/copyleft/gpl.html
# Date: 2012-07-14
#
# This script concatenates (joins, merges) several audio/video inputs into one
@m1entus
m1entus / build-ffmpeg.sh
Last active June 22, 2024 04:06
Installing ffmpeg ios libraries armv7, armv7s, i386
#!/bin/bash
###########################################################################
# Choose your ffmpeg version and your currently-installed iOS SDK version:
#
VERSION="2.0.2"
SDKVERSION="7.0"
ARCHS="armv7 armv7s i386"
#
#