/\_/\ /\_/\
- =( owo )= =( owo )=
\ ) ( ) ( //
\(_ _ _) (_ _ _)//
- C
- (void)listSubviewsOfView:(UIView *)view { | |
[self listSubviewsOfView:(UIView *)view withPrefix:@""]; | |
} | |
- (void)listSubviewsOfView:(UIView *)view withPrefix:(NSString *)prefix { | |
NSArray *subviews = [view subviews]; | |
for (UIView *subview in subviews) { | |
NSLog(@"%@ %@ (%d %d; %d %d)", prefix, subview.class | |
, (int)subview.frame.origin.x | |
, (int)subview.frame.origin.y | |
, (int)subview.frame.size.width |
create dummy images | |
curl -L "http://dummyimage.com/600x400/000/fff&text=DummyImage%20[01-10]" -o image_#1.png | |
get page headers | |
curl --head http://google.com | |
send parameters to page | |
curl.exe -L -G "http://yoururl.com" --data-urlencode "text=DESIGN6 daily backup started" | |
send formdata & files to page |
extension NSAttributedString { | |
func replaceHTMLTag(tag: String, withAttributes attributes: [String: AnyObject]) -> NSAttributedString { | |
let openTag = "<\(tag)>" | |
let closeTag = "</\(tag)>" | |
let resultingText: NSMutableAttributedString = self.mutableCopy() as NSMutableAttributedString | |
while true { | |
let plainString = resultingText.string as NSString | |
let openTagRange = plainString.rangeOfString(openTag) | |
if openTagRange.length == 0 { |
/\_/\ /\_/\
- =( owo )= =( owo )=
\ ) ( ) ( //
\(_ _ _) (_ _ _)//
// direct check for external keyboard | |
+ (BOOL)_isExternalKeyboardAttached | |
{ | |
BOOL externalKeyboardAttached = NO; | |
@try { | |
NSString *keyboardClassName = [@[@"UI", @"Key", @"boa", @"rd", @"Im", @"pl"] componentsJoinedByString:@""]; | |
Class c = NSClassFromString(keyboardClassName); | |
SEL sharedInstanceSEL = NSSelectorFromString(@"sharedInstance"); | |
if (c == Nil || ![c respondsToSelector:sharedInstanceSEL]) { |
let toImage = UIImage(named:"image.png") | |
UIView.transitionWithView(self.imageView, | |
duration:5, | |
options: .TransitionCrossDissolve, | |
animations: { self.imageView.image = toImage }, | |
completion: nil) |
public boolean isColorDark(int color){ | |
double darkness = 1-(0.299*Color.red(color) + 0.587*Color.green(color) + 0.114*Color.blue(color))/255; | |
if(darkness<0.5){ | |
return false; // It's a light color | |
}else{ | |
return true; // It's a dark color | |
} | |
} |
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\Folder\shell\Unity5] | |
@="" | |
"Icon"="%ProgramFiles%\\Unity\\Editor\\Unity.exe" | |
"MUIVerb"="Open as Unity Project" | |
[HKEY_CLASSES_ROOT\Folder\shell\Unity5\Command] | |
@="cmd /c start /D\"c:\\Program Files\\Unity\\Editor\\\" Unity.exe -projectPath \"%1\"" |
///Returns the input value clamped to the lower and upper limits. | |
func clamp<T: Comparable>(value: T, lower: T, upper: T) -> T { | |
return min(max(value, lower), upper) | |
} | |
//----------------------------------------------- | |
// Example usage | |
let proposedIndex = 6 |
package com.gabesechan.android.reusable.receivers; | |
import java.util.Date; | |
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.telephony.TelephonyManager; | |
public abstract class PhonecallReceiver extends BroadcastReceiver { |