Skip to content

Instantly share code, notes, and snippets.

Avatar
🛰️
Converting ideas into fun

Serg ReDetection

🛰️
Converting ideas into fun
View GitHub Profile
@ReDetection
ReDetection / flow.json
Last active May 27, 2021
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)
View flow.json
[
{
"id": "da5a0b28.008b",
"type": "subflow",
"name": "Room light v3 supported command?",
"info": "",
"category": "",
"in": [
{
"x": 73.33333015441895,
View 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 Oct 16, 2015
GitLab CI .gitlab-ci.yml template
View .gitlab-ci.yml
stages:
- test
build_code:
stage: test
script:
- xcodebuild test -workspace MyProject.xcworkspace -scheme MyProjectTests | xcpretty -c && exit ${PIPESTATUS[0]}
@ReDetection
ReDetection / gist:30a1d2902c7b50cb3846
Created Oct 10, 2014
please let me kill this guy
View gist:30a1d2902c7b50cb3846
NSString *deliveryTime = [NSString stringWithFormat:@"%@", (deliveryHour >= 10 ? [NSString stringWithFormat:@"%d", deliveryHour] : [NSString stringWithFormat:@"0%d", deliveryHour]) ];
@ReDetection
ReDetection / gist:e2cbbaf730493b788909
Created Sep 25, 2014 — forked from gdavis/gist:2845766
fixed conversion warning
View gist:e2cbbaf730493b788909
#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)
View gist:f4a157517eafff978ede
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;