Skip to content

Instantly share code, notes, and snippets.

@n-miyo
n-miyo / main.swift
Created Nov 10, 2014
Link error will be occurred if a Swift class inherits NSObject with single case enum typed property.
View main.swift
import Foundation
enum E {
case A
//, B
}
class C//: NSObject
{
var e: E
@n-miyo
n-miyo / gitlab
Last active May 28, 2017 — forked from denvazh/gitlab
View gitlab
#!/bin/sh
#
# Written by Denis Vazhenin <denis.vazhenin@me.com>
#
# This script was ported from Debian/Ubuntu version of start script for Gitlab:
# https://raw.github.com/gitlabhq/gitlabhq/master/lib/support/init.d/gitlab
#
# PROVIDE: gitlab
# REQUIRE: NETWORKING SERVERS DAEMON LOGIN
# KEYWORD: shutdown
@n-miyo
n-miyo / gist:4702071
Created Feb 3, 2013
How to use asynchronous request with TPTimeoutURLConnection.
View gist:4702071
@interface FooDelegate : TPURLConnectionDelegate
//...
@end
@implementation FooDelegate
- (void)connection:(NSURLConnection *)connection
didFailWithError:(NSError *)error
{
[super connection:connection didFailWithError:error];
// my code...
@n-miyo
n-miyo / gist:4702058
Created Feb 3, 2013
How to use synchronous request with TPTimeoutURLConnection.
View gist:4702058
NSURLResponse *response = nil;
NSError *error = nil;
NSData *d =
[NSURLConnection
sendSynchronousRequest:urlRequest
timeoutInterval:5.0
returningResponse:&response
error:&error];
@n-miyo
n-miyo / named.sb
Created Nov 19, 2012
modified named sandbox profile
View named.sb
;;
;; named - sandbox profile
;; Copyright (c) 2006-2007 Apple Inc. All Rights reserved.
;;
;; WARNING: The sandbox rules in this file currently constitute
;; Apple System Private Interface and are subject to change at any time and
;; without notice. The contents of this file are also auto-generated and not
;; user editable; it may be overwritten at any time.
;;
(version 1)
@n-miyo
n-miyo / gist:1273211
Created Oct 9, 2011
patch for emacs-inline.patch(apply with p0)
View gist:1273211
--- src.orig/macim.m 2011-10-05 22:36:20.000000000 +0900
+++ src/macim.m 2011-10-05 22:36:40.000000000 +0900
@@ -100,7 +100,14 @@
}
else
{
- NSString *locale = [[NSLocale currentLocale] localeIdentifier];
+ NSString *locale;
+ NSArray *languages = [NSLocale preferredLanguages];
+ if (languages != nil) {
@n-miyo
n-miyo / gist:1250669
Created Sep 29, 2011
patch for emacs-inline.patch: Use preferredLanguages instead of currentLocale.
View gist:1250669
diff --git a/src/macim.m b/src/macim.m
index d4444db..515cf25 100644
--- a/src/macim.m
+++ b/src/macim.m
@@ -100,7 +100,14 @@ DEFUN ("mac-toggle-input-source", Fmac_toggle_input_source,
}
else
{
- NSString *locale = [[NSLocale currentLocale] localeIdentifier];
+ NSString *locale;
@n-miyo
n-miyo / c.c
Created May 19, 2011
select/recvfrom issue
View c.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <err.h>
#include <netdb.h>
#include <time.h>
#include <sys/types.h>
#include <sys/socket.h>
You can’t perform that action at this time.