Skip to content

Instantly share code, notes, and snippets.

Avatar

Mutable Studio mutablestudio

View GitHub Profile
@mutablestudio
mutablestudio / sizeclass
Last active Feb 22, 2019
react-native size class func
View sizeclass
export const isMediumHeight = height < 750 && height >= 600
export const isSmallHeight = width < 600
export const setImageScale = (size, type) => {
console.log(`smallImageScale height ${height} size ${size} type ${type}`)
switch(true) {
case isMediumHeight:
reduceBy = type === 'large' ? .55 : .85
return Math.round(size * reduceBy);
case isSmallHeight:
View keybase.md

Keybase proof

I hereby claim:

  • I am mutablestudio on github.
  • I am mutablestudio (https://keybase.io/mutablestudio) on keybase.
  • I have a public key ASBLPMBWbBgZDiqw_IQ47mVdoS5eyZZZt-Hghs3S7GZeYwo

To claim this, I am signing this object:

@mutablestudio
mutablestudio / performSelectorWithArgument
Last active Feb 14, 2017
swift 3 perform selector with argument
View performSelectorWithArgument
//if you have a dictionary object passed in, and one element is the function name you can do the following
//inbound 'params' as [String: Any]
let funcName = String(format: "%@:", (params["function"] as? String)!) //note the ':' for single parameter method
let selector = NSSelectorFromString(funcName)
self.perform(selector, with: params)
func getSomeData(_ params: [String: Any]) {
print(params)
}
View GPUImageFilterFactory
/*
* This is a GPUImageFilter Factory concept, essentially to reuse common GPUImage code that's
* required for most GPUImageFilter calls. Access to these methods then becomes a one liner...
*
* Be sure to wrap each new Class method you create with @autoreleasepool for improved performance.
*
*/
#import "GPUImage.h"
#import "mach/mach.h"