This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.kinpo.android_test; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.os.Bundle; | |
import android.support.v4.content.LocalBroadcastManager; | |
import android.util.Log; | |
import android.view.View; | |
import android.view.View.OnClickListener; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((EditTextPreference) findPreference("pref_scanning_editdialog")) | |
.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { | |
@Override | |
public boolean onPreferenceChange(Preference preference, Object newValue) { | |
String value = newValue.toString(); | |
if ( !value.isEmpty() ) { | |
// This doesn't seem right | |
CharSequence[] entries = list.getEntryValues(); | |
ArrayList<CharSequence> entryList = new ArrayList<>(Arrays.asList(entries)); | |
entryList.add(value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.kinpo.bcutility; | |
import java.util.LinkedList; | |
import java.util.concurrent.TimeUnit; | |
import com.kinpo.bcutility.settings.Settings.CommandBehavior; | |
import com.kinpo.training.lazyutils.Debug; | |
public class CommandProcessor implements Runnable { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
int pageCount = 2; | |
// int pageWidth = self.view.frame.size.width; | |
// int pageHeight = self.view.frame.size.height; | |
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; | |
for(int i = 0;i < pageCount; ++i) { | |
UIViewController *page = [storyBoard | |
instantiateViewControllerWithIdentifier: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSArray *APPLIANCES_ARRAY = @[@"Fridge",@"Microwave",@"PS3/PS4/XBOX"]; | |
for(id appliance_group in APPLIANCES_ARRAY) { | |
NSLog(@"%@", appliance_group); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@property (atomic, setter=setRunning:, getter=mIsRunning) BOOL mIsRunning; | |
@property (strong, nonatomic) FifoQueue *queue; | |
@end | |
@implementation BcxCommandQueueService | |
@synthesize mIsRunning; | |
#pragma mark - GETTERS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)query:(NSString *)query completion:(CompletionCallback)completion { | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ { | |
while(isBusy) { | |
// wait for it | |
// or should I say, sleep? | |
} | |
isBusy = YES; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)test_printDateVariants { | |
NSDateFormatter *fmt = [NSDateFormatter new]; | |
NSTimeZone *timezone = [NSTimeZone timeZoneWithName:@"UTC"]; | |
[fmt setTimeZone:timezone]; | |
[fmt setDateFormat:@"yyyy-MM-dd hh:mm:ss Z"]; | |
NSCalendar *calendar = [NSCalendar currentCalendar]; | |
for(int i = 1;i <= 31; ++i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT u.firstName AS sender FROM users u | |
INNER JOIN messages m | |
ON m.senderId = u.id | |
WHERE m.status = 'pending' | |
AND m.recipientId = $userId | |
-- GROUP BY u.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function updateUsersStatus() { | |
global $db; | |
$sql = "UPDATE users SET users.active = false WHERE users.lastSeenActive = NOW() - INTERVAL 10 SECOND"; | |
$result = $db->query($sql); | |
if ($result) { | |
// we don't care about the result | |
} | |
else { |