Skip to content

Instantly share code, notes, and snippets.

View pixnbit's full-sized avatar

Xiaochao Yang pixnbit

  • San Francisco Bay Area
  • 15:21 (UTC -07:00)
View GitHub Profile
@pixnbit
pixnbit / ContactPhonesTest.kt
Created April 14, 2021 02:09 — forked from mustafo/ContactPhonesTest.kt
The right way to use one to many relationship in jdbi with kotlin
import org.jdbi.v3.core.kotlin.KotlinMapper
import org.jdbi.v3.core.mapper.RowMapperFactory
import org.junit.jupiter.api.Test
import tj.alif.core.app.db.RepositoryTest
import org.jdbi.v3.core.result.RowView
data class Contact (
val id: Int,
val name: String,
@pixnbit
pixnbit / AppReviews
Created February 26, 2018 05:57 — forked from kgn/AppReviews
App Reviews - Python script to retrieve App Store reviews and save them to a CSV file
#!/usr/bin/env python
try:
# For Python 3.0 and later
from urllib.request import urlopen
except ImportError:
# Fall back to Python 2's urllib2
from urllib2 import urlopen
import json
CIFilter *resizeFilter = [CIFilter filterWithName:@"CILanczosScaleTransform"];
[resizeFilter setValue:ciImage forKey:@"inputImage"];
[resizeFilter setValue:[NSNumber numberWithFloat:1.0f] forKey:@"inputAspectRatio"];
[resizeFilter setValue:[NSNumber numberWithFloat:xRatio] forKey:@"inputScale"];
CIFilter *cropFilter = [CIFilter filterWithName:@"CICrop"];
CIVector *cropRect = [CIVector vectorWithX:rect.origin.x Y:rect.origin.y Z:rect.size.width W:rect.size.height];
[cropFilter setValue:resizeFilter.outputImage forKey:@"inputImage"];
[cropFilter setValue:cropRect forKey:@"inputRectangle"];
CIImage *croppedImage = cropFilter.outputImage;