Skip to content

Instantly share code, notes, and snippets.

View Bayonetta's full-sized avatar
🎯
Focusing

Bayonetta Bayonetta

🎯
Focusing
  • Nomi
View GitHub Profile
@Bayonetta
Bayonetta / gist:bf699390e49bbc5f64262eb9aab61254
Created August 30, 2017 06:39
line_history_version.xml
<plist version="1.0">
<dict>
<key>pings</key>
<array />
<key>jingleDocType</key>
<string>purchaseSuccess</string>
<key>jingleAction</key>
<string>purchaseProduct</string>
<key>status</key>
<integer>0</integer>
@Bayonetta
Bayonetta / shake.m
Created February 15, 2017 04:09
How to add vibrate feedback
#pragma mark - AudioServicesPlaySystemSound
- (IBAction)shake0:(UIButton *)sender {
// `Peek` 震动反馈 (weak boom)
AudioServicesPlaySystemSound(1519);
}
- (IBAction)shake1:(UIButton *)sender {
// `Pop` 震动反馈 (strong boom)
@Bayonetta
Bayonetta / extractor.rb
Created June 14, 2016 06:55
Fetch Mac OS inner emoij pngs
# encoding: US-ASCII
# stolen largely from http://www.ruby-forum.com/topic/140784
require 'stringio'
require 'fileutils'
def extract_chunk(input, output)
lenword = input.read(4)
length = lenword.unpack('N')[0]
type = input.read(4)
@Bayonetta
Bayonetta / countWord.m
Created November 3, 2015 02:49
Sina Count Word Method
- (int)sinaCountWord:(NSString*)s
{
int i,n=[s length],l=0,a=0,b=0;
unichar c;
for(i=0;i<n;i++){
c=[s characterAtIndex:i];
if(isblank(c)){
b++;
}else if(isascii(c)){
a++;
@Bayonetta
Bayonetta / gist:0f65a468ef9a96d810a9
Created June 29, 2015 03:30
查看可识别XXX url scheme的应用bundle id 列表
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSLog(@"openURL: %@",[workspace performSelector:@selector(applicationsAvailableForHandlingURLScheme:)withObject:@"XXX"]);
@Bayonetta
Bayonetta / gist:f3f69a377252cceac71f
Created June 18, 2015 02:39
Get And Detect Camera Roll Group
//To get photos from camera roll use ALAssetsGroupSavedPhotos while enumerating assets library:
[library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos
usingBlock:enumerate
failureBlock:nil];
//To detect what group you currently get:
if ([[group valueForProperty:@"ALAssetsGroupPropertyType"] intValue] == ALAssetsGroupSavedPhotos)
{
NSLog(@"Camera roll");
@Bayonetta
Bayonetta / generater.sh
Created March 5, 2015 08:24
ios simulator build
xcodebuild -workspace {project name}.xcworkspace -scheme {project name} -arch i386 -sdk iphonesimulator7.1
@Bayonetta
Bayonetta / compress.py
Created February 6, 2015 09:03
auto transform png file format from png24 to png8
# -*- coding: utf-8 -*-
"""将PNG图片用pngquant进行批量压缩
安装: http://pngquant.org
"""
import os
import sys
import os.path
import subprocess
@Bayonetta
Bayonetta / MimeTypes.txt
Created January 26, 2015 13:11
Mime types collection
MIME_TYPES = {
".123" => "application/vnd.lotus-1-2-3",
".3dml" => "text/vnd.in3d.3dml",
".3g2" => "video/3gpp2",
".3gp" => "video/3gpp",
".a" => "application/octet-stream",
".acc" => "application/vnd.americandynamics.acc",
".ace" => "application/x-ace-compressed",
".acu" => "application/vnd.acucobol",
".aep" => "application/vnd.audiograph",