Skip to content

Instantly share code, notes, and snippets.

@n-miyo
n-miyo / main.swift
Created November 10, 2014 07:01
Link error will be occurred if a Swift class inherits NSObject with single case enum typed property.
import Foundation
enum E {
case A
//, B
}
class C//: NSObject
{
var e: E
@n-miyo
n-miyo / c.c
Created May 19, 2011 15:26
select/recvfrom issue
#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>
@n-miyo
n-miyo / gist:1250669
Created September 29, 2011 12:53
patch for emacs-inline.patch: Use preferredLanguages instead of currentLocale.
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 / gist:1273211
Created October 9, 2011 02:52
patch for emacs-inline.patch(apply with p0)
--- 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 / named.sb
Created November 19, 2012 23:54
modified named sandbox profile
;;
;; 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:4702058
Created February 3, 2013 14:45
How to use synchronous request with TPTimeoutURLConnection.
NSURLResponse *response = nil;
NSError *error = nil;
NSData *d =
[NSURLConnection
sendSynchronousRequest:urlRequest
timeoutInterval:5.0
returningResponse:&response
error:&error];
@n-miyo
n-miyo / gist:4702071
Created February 3, 2013 14:48
How to use asynchronous request with TPTimeoutURLConnection.
@interface FooDelegate : TPURLConnectionDelegate
//...
@end
@implementation FooDelegate
- (void)connection:(NSURLConnection *)connection
didFailWithError:(NSError *)error
{
[super connection:connection didFailWithError:error];
// my code...
@n-miyo
n-miyo / gitlab
Last active May 28, 2017 07:17 — forked from denvazh/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
// ==UserScript==
// @name Suppresses unwanted sending with Enter key
// @namespace http://tempus.org
// @version 0.3
// @description Suppresses unwanted sending with Enter key on ChatGPT.
// @author n-miyo
// @match https://chat.openai.com
// @match https://chat.openai.com/?model*
// @match https://chat.openai.com/c/*
// @grant none