Skip to content

Instantly share code, notes, and snippets.

@hyuni
hyuni / StringExtension.swift
Created March 24, 2016 07:03 — forked from overtrue/StringExtension.swift
Swift Extensions
import Foundation
extension String {
var length: Int {
return (self as NSString).length
}
func split(separator: Character) -> [String] {
return self.characters.split { $0 == separator }.map(String.init)
}
@hyuni
hyuni / DataUsage.swift
Created March 20, 2016 10:57 — forked from n-studio/DataUsage.swift
Get data usage with swift
#include <ifaddrs.h>
// http://stackoverflow.com/questions/25626117/how-to-get-ip-address-in-swift
func getIFAddresses() -> [String] {
var addresses = [String]()
// Get list of all interfaces on the local machine:
var ifaddr : UnsafeMutablePointer<ifaddrs> = nil
if getifaddrs(&ifaddr) == 0 {
@hyuni
hyuni / Communicator.h
Created February 4, 2016 12:42 — forked from rjungemann/Communicator.h
How to open a TCP socket in Objective-C
#import <Foundation/Foundation.h>
@interface Communicator : NSObject <NSStreamDelegate> {
@public
NSString *host;
int port;
}
- (void)setup;
@hyuni
hyuni / vImageBlurTest.mm
Created January 31, 2016 05:22 — forked from zapsleep/vImageBlurTest.mm
Creating blur image from given with vImage
- (UIImage *)blurryImage:(UIImage *)image withBlurLevel:(CGFloat)blur {
if (blur < 0.f || blur > 1.f) {
blur = 0.5f;
}
int boxSize = (int)(blur * 100);
boxSize = boxSize - (boxSize % 2) + 1;
CGImageRef img = image.CGImage;
vImage_Buffer inBuffer, outBuffer;
@hyuni
hyuni / gist:a79dd8587d7302141314
Created January 31, 2016 05:22 — forked from Nyx0uf/gist:217d97f81f4889f4445a
UIImage scale using vImage
-(UIImage*)mmg_imageScaledToFitSize:(CGSize)fitSize
{
// Create a vImage_Buffer from the CGImage
CGImageRef sourceRef = self.CGImage;
vImage_Buffer srcBuffer;
vImage_CGImageFormat format = {
.bitsPerComponent = 8,
.bitsPerPixel = 32,
.colorSpace = NULL,
.bitmapInfo = (CGBitmapInfo)kCGImageAlphaFirst,
@hyuni
hyuni / Image.swift
Created January 31, 2016 05:21 — forked from indragiek/Image.swift
vImage_Buffer wrapper
// Copyright © 2015 Indragie Karunaratne. All rights reserved.
import Foundation
import Accelerate
public class Image {
private var buffer: vImage_Buffer
public var size: CGSize {
return vImageBuffer_GetSize(&buffer)
@hyuni
hyuni / CVPixelBufferUtils.h
Created January 31, 2016 05:20 — forked from cookbrianj/CVPixelBufferUtils.h
vImage helpers
//
// PixelBufferUtils.h
// IRStudio
//
// Created by Brian Cook on 5/30/12.
// Copyright (c) 2012 All rights reserved.
//
#import <Accelerate/Accelerate.h>
#import "BCNeonImageUtils.h"
#!/bin/bash
: << '#__REM__'
指定さたライブラリをiOS用にフルオートで作成します。ダウンロード、複数のアーキテクチャのビルドも自動的に行います。デフォルトではi386、x86_64、armv7、armv7s、arm64のアーキテクチャを作成します。
Create a full-auto to iOS for the library specified. I do also builds the architecture download, more than one. Create architecture i386, x86_64, armv7, armv7s, arm64 by default.
#__REM__
TARGET_VERSION="1.3.1"
@hyuni
hyuni / PersistentCookieStore.java
Created January 21, 2016 08:48 — forked from franmontiel/PersistentCookieStore.java
A persistent CookieStore implementation for use in Android with HTTPUrlConnection or OkHttp.
/*
* Copyright (c) 2015 Fran Montiel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@hyuni
hyuni / vlc-buildsystem-fix-xcode-4.3
Created January 18, 2016 07:19 — forked from lfranchi/vlc-buildsystem-fix-xcode-4.3
VLC buildsystem fix for XCode 4.3
diff --git a/contrib/bootstrap b/contrib/bootstrap
index df3dd85..a0a7244 100755
--- a/contrib/bootstrap
+++ b/contrib/bootstrap
@@ -143,15 +143,19 @@ add_make_enabled()
check_macosx_sdk()
{
- [ -z "${OSX_VERSION}" ] && echo "OSX_VERSION not specified, assuming 10.5" && OSX_VERSION=10.5
- SDK="/Developer/SDKs/MacOSX${OSX_VERSION}.sdk"