Skip to content

Instantly share code, notes, and snippets.

@mutekinootoko
mutekinootoko / make_github_issue.py
Last active May 17, 2017 15:00 — forked from JeffPaine/make_github_issue.py
Make an issue on github using API V3 and Python
import json
import requests
# Authentication for user filing issue (must have read/write access to
# repository to add issue to)
USERNAME = 'CHANGEME'
PASSWORD = 'CHANGEME'
# The repository to add this issue to
REPO_OWNER = 'CHANGEME'
@mutekinootoko
mutekinootoko / LuceneLab.java
Created October 31, 2016 05:14 — forked from qrtt1/LuceneLab.java
複習 Lucene 的用法 (6.x)
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.cjk.CJKAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.TextField;
@mutekinootoko
mutekinootoko / avatar.m
Created December 17, 2015 12:07
put avatar on button
// setup code to draw / display avatar
UIView *avatarView = [[UIView alloc] init];
avatarView.frame = CGRectMake(20, 50, 280, 100);
avatarView.layer.borderColor = [UIColor redColor].CGColor;
avatarView.layer.borderWidth = 3.0f;
[self.view addSubview:avatarView];
// do additional loading for avatars
UIButton *avatarButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
// the last two values control the size of the button
@mutekinootoko
mutekinootoko / content.m
Last active September 11, 2015 09:28 — forked from fousa/content.m
Localize NSError
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
[userInfo setObject:@"You are not authenticated." forKey:NSLocalizedDescriptionKey];
NSError *error = [NSError errorWithDomain:@"mydomain" code:0 userInfo:userInfo];
//@author http://stackoverflow.com/questions/5712527/how-to-detect-total-available-free-disk-space-on-the-iphone-ipad-device
- (uint64_t)freeDiskspace
{
uint64_t totalSpace = 0;
uint64_t totalFreeSpace = 0;
NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];