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" ],
@dduan
dduan / UISegmentedControl+VerticalLayout.swift
Last active July 25, 2024 05:52
Turns a UISegmentedControl into a vertical layout.
import UIKit
extension UISegmentedControl {
func goVertical() {
self.transform = CGAffineTransformMakeRotation(CGFloat(M_PI_2))
for segment in self.subviews {
for segmentSubview in segment.subviews {
if segmentSubview is UILabel {
(segmentSubview as UILabel).transform = CGAffineTransformMakeRotation(CGFloat(-M_PI_2))
}
@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
@michaelevensen
michaelevensen / EventKit.swift
Last active March 31, 2025 01:27
Steps for fetching events from EventKit. NOTE! For iOS10+ remember to add: Privacy โ€“ Calendars Usage Description in .plist
// Helper function for showing UIAlert prompts
func showMessagePrompt(_ title: String, message: String) {
let alert = UIAlertController.init(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction.init(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
/********************/