Skip to content

Instantly share code, notes, and snippets.

@nek023
nek023 / LaunchAtLoginController.h
Last active December 12, 2019 04:26
A helper class to manage login items in non-sandboxed app.
//
// LaunchAtLoginController.h
// LaunchAtLoginController
//
// Created by Katsuma Tanaka on 2014/04/12.
// Copyright (c) 2014年 Katsuma Tanaka. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UIColor (HSBFunctions)
- (UIColor *)lightenedColorByPercent:(CGFloat)percent;
- (UIColor *)darkenedColorByPercent:(CGFloat)percent;
@end
@nek023
nek023 / supervisord
Created January 11, 2014 11:18
chkconfig script for supervisor (put this script on /etc/rc.d/init.d/supervisord) http://yosida95.hatenablog.com/entry/20120322/1332439575
#!/bin/sh
# chkconfig: - 15 15
# description: Copyright (C) yosida95 All Right Reserved.
. /etc/rc.d/init.d/functions
SUPERVISORD="/usr/bin/supervisord"
PIDFILE="/var/run/supervisord.pid"
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
#include <iostream>
#include <vector>
#include <cmath>
#include <limits.h>
#include <string>
#include <sstream>
using namespace std;
#!/bin/bash
rew tap | sed -e "s/^/tap '/g" | sed -e "s/$/'/g" > Brewfile
brew list | sed -e "s/^/brew '/g" | sed -e "s/$/'/g" >> Brewfile
curl 'https://api.github.com/users/questbeat/gists?page=1' | jq "."
// iPadの場合にcontentのwidthを指定してやらないとdevice-width(768 or 1024)になってしまう
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
NSString *script = [NSString stringWithFormat:@"document.querySelector('meta[name=viewport]').setAttribute('content', 'width=%d;', false); ", 320];
[webView stringByEvaluatingJavaScriptFromString:script];
}
my $db = Intern::Diary::DBI::Factory->new;
my $dbh = $db->dbh('intern_diary');
my $sth = $dbh->prepare(q[
INSERT INTO entry
SET
user_id = ?,
title = ?,
content = ?,
draft = ?,