Skip to content

Instantly share code, notes, and snippets.

View ReDetection's full-sized avatar
🛰️
Converting ideas into fun

Serg ReDetection

🛰️
Converting ideas into fun
View GitHub Profile
@ReDetection
ReDetection / flow.json
Last active May 27, 2021 07:37
Exported Node-Red flow for automatic light control. Install following plugins into Node-Red: node-red-contrib-home-assistant-websocket, node-red-contrib-frp, node-red-contrib-time-range-switch. See https://vas3k.club/post/3516/ for a nice explanation (In Russian)
[
{
"id": "da5a0b28.008b",
"type": "subflow",
"name": "Room light v3 supported command?",
"info": "",
"category": "",
"in": [
{
"x": 73.33333015441895,
@ReDetection
ReDetection / filterHotelsByRatePlan.js
Created November 11, 2015 16:34
filterHotelsByRatePlan.js
import R from 'ramda';
// [] -> Boolean
function notEmpty(xs) {
return xs.length > 0;
}
// (RatePlan -> Boolean) -> [AvailableHotel] -> [AvailableHotel]
function filterHotelsByRatePlan(ratePlanIndicator) {
const ratePlans = R.filter(ratePlanIndicator);
@ReDetection
ReDetection / .gitlab-ci.yml
Created October 16, 2015 11:59
GitLab CI .gitlab-ci.yml template
stages:
- test
build_code:
stage: test
script:
- xcodebuild test -workspace MyProject.xcworkspace -scheme MyProjectTests | xcpretty -c && exit ${PIPESTATUS[0]}
@ReDetection
ReDetection / gist:30a1d2902c7b50cb3846
Created October 10, 2014 06:41
please let me kill this guy
NSString *deliveryTime = [NSString stringWithFormat:@"%@", (deliveryHour >= 10 ? [NSString stringWithFormat:@"%d", deliveryHour] : [NSString stringWithFormat:@"0%d", deliveryHour]) ];
@ReDetection
ReDetection / gist:e2cbbaf730493b788909
Created September 25, 2014 11:00 — forked from gdavis/gist:2845766
fixed conversion warning
#pragma mark - Phone Number Field Formatting
// Adopted from: http://stackoverflow.com/questions/6052966/phone-number-formatting
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if (textField == self.mobileNumberField || textField == self.homeNumberField || textField == self.workNumberField) {
int length = [self getLength:textField.text];
if(length == 10) {
if(range.length == 0)
NSString *urlString = @"https://api.mongolab.com/api/1/databases/todo/collections/tasks/";
NSURL *url = [NSURL URLWithString:urlString];
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:url];
NSDictionary *key = @{@"apiKey": @"MWxF-8RKg5wx4oLLDDDZa5Mdd01to7zV"};
void (^logMessage)(RACTuple *) = ^(RACTuple * x) {
AFHTTPRequestOperation *operation = x.first;
NSData *data = x.second;