Skip to content

Instantly share code, notes, and snippets.

View TuenTuenna's full-sized avatar
😍
Happy coding 👏

개발하는 정대리 TuenTuenna

😍
Happy coding 👏
View GitHub Profile
@codeswimmer
codeswimmer / Android.Bitmap.Rotate
Created March 7, 2011 17:25
Android: rotate a bitmap
public Bitmap rotateBitmap(Bitmap original, float degrees) {
int width = original.getWidth();
int height = original.getHeight();
Matrix matrix = new Matrix();
matrix.preRotate(degrees);
Bitmap rotatedBitmap = Bitmap.createBitmap(original, 0, 0, width, height, matrix, true);
Canvas canvas = new Canvas(rotatedBitmap);
canvas.drawBitmap(original, 5.0f, 0.0f, null);
@keicoder
keicoder / snippet.m
Last active April 7, 2024 13:08
objective-c : iOS 7 스토리보드 대신 xib 방식으로 개발하기
//iOS 7 스토리보드 대신 xib 방식으로 개발하기
//solution 1
1. empty application 생성
2. new class file 생성 -> name : ViewController, UIViewController sub class, with XIB check
3. appdelegate 헤더 파일 수정
@class ViewController;
@property (strong, nonatomic) ViewController *viewController;
4. appdelegate m 파일 수정
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@piruin
piruin / BitmapFromMediaUri.java
Created October 2, 2015 17:21
How to get bitmap from URI
InputStream is = getContentResolver().openInputStream(uri);
Bitmap bitmap = BitmapFactory.decodeStream(is);
is.close();
@ihoneymon
ihoneymon / use-git-and-git-flow.adoc
Last active November 8, 2023 22:45
git 을 기반으로 git-flow를 사용하여 애플리케이션 배포버전을 관리하자.

GIT을 기반으로 한 프로젝트 개발프로세스

깃을 사용합시다. 깃을 쓰자. 깃을 쓰란 말야!!

  • SVN은 변경이력이 많아질수록 속도가 느리지.

    • 커밋 및 처리속도가 빠르다. 변경이력이 많이 축적되어 있어도 속도저하가 거의 없다.

  • 커밋찍기가 어렵다.

//
// UIBarButtonItem+Badge.swift
// PiGuardMobile
//
// Created by Stefano Vettor on 12/04/16.
// Copyright © 2016 Stefano Vettor. All rights reserved.
//
import UIKit
@stevenojo
stevenojo / ObjectiveCDebounce.md
Last active May 6, 2023 23:56
Objective-C Debounce Example Using GCD Dispatch Sources / Timer

##Debouncing using GCD on iOS

The idea of "Debouncing" is to limit the rate a function or task can execute by waiting a certain amount of time before executing it. In the example below, if a user rapidly enters input, it will only execute once, 1 second after all that input. This is the implementation of a sample class showing how to do so, while using Grand Central Dispatch to create a timer. The timer fires on a global queue in this example - but you can change the queue to any queue where you want the timer to execute, regardless of where you set it up.

#import <Foundation/Foundation.h>

@interface DebounceExample : NSObject
@dmathewwws
dmathewwws / URLSession POST.swift
Created November 5, 2016 01:35
URLSession POST request example
private static func createUserEventData(user:SKUser, eventType:SKEventType, sticker:Sticker?) {
// server endpoint
let endpoint = "https://app.stickerkit.io/userEvent/v1/\(user.projectID)"
guard let endpointUrl = URL(string: endpoint) else {
return nil
}
//Make JSON to send to send to server
@diegoventura
diegoventura / UIView+Extensions.swift
Last active November 11, 2023 10:35
Extension to add borders to a UIView with Auto Layout
public extension UIView {
func addBorder(to edges: UIRectEdge, color: UIColor = UIColor.white, thickness: CGFloat = 1) {
var borders = [UIView]()
func border() -> UIView {
let border = UIView(frame: CGRect.zero)
border.backgroundColor = color
border.translatesAutoresizingMaskIntoConstraints = false
@juzooda
juzooda / structToDic.playground
Created March 9, 2017 14:40
Simple Protocol to convert swift structs to dictionaries
import UIKit
struct Person: DictionaryConvertor {
let name: String
let job: [Job]?
let errors: [String]?
}
struct Job: DictionaryConvertor {
let title: String