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
#import "NSString+Contains.h" | |
@implementation NSString (Contans) | |
- (BOOL) containsString: (NSString*) substring | |
{ | |
NSRange range = [self rangeOfString : substring]; | |
BOOL found = ( range.location != NSNotFound ); | |
return found; | |
} |
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
- (BOOL) addSkipBackupAttributeToItemAtURL:(NSURL *)URL | |
{ | |
const char* filePath = [[URL path] fileSystemRepresentation]; | |
const char* attrName = "com.apple.MobileBackup"; | |
u_int8_t attrValue = 1; | |
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0); | |
return result == 0; | |
} |
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 QuietLog (NSString *format, ...) { | |
va_list argList; | |
va_start (argList, format); | |
NSString *string; | |
string = [[NSString alloc] initWithFormat: format | |
arguments: argList]; | |
va_end (argList); | |
printf ("%s\n", [string UTF8String]); | |
} |
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
# encoding: utf-8 | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'data_mapper' | |
require 'dm-sqlite-adapter' | |
require 'date' | |
require 'set' | |
require 'json' |
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
class CthulhuBag | |
def initialize | |
@h = Hash.new{ 0 } | |
end | |
def <<(o) | |
@h[o] += 1 | |
end | |
def [](o) | |
@h[o] | |
end |
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
const axios = require('axios'); | |
const API_KEY = process.env.REFERRAL_API_KEY; | |
const CAMPAIGN_ID = process.env.REFERRAL_CAMPAIGN_ID; | |
const REQUIREMENT_ID = process.env.REFERRAL_REQUIREMENT_ID; | |
const BASE_URL = process.env.REFERRAL_BASE_URL; | |
const SYNC_USER_PATH = '/users'; | |
const UPDATE_TRACKED_BALANCE_PATH = (userId) => | |
`/users/${userId}/campaign/${CAMPAIGN_ID}/tracked/balance`; |
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
import express from "express"; | |
import axios from "axios"; | |
import { createClient } from "redis"; | |
import { promisify } from "util"; | |
const app = express(); | |
const PORT = process.env.PORT || 3000; | |
const REDIS_URL = process.env.REDIS_URL; // Replace with actual one | |
export const URLS = { |
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
import express, { Request, Response } from "express"; | |
import axios from "axios"; | |
import { createClient } from "redis"; | |
const FIFTEEN_MINUTES_IN_MILLISECONDS = 15 * 60 * 1000; | |
const THREE_DAYS_IN_SECONDS = 3 * 24 * 60 * 60; | |
const PORT = Number(process.env.PORT) || 3000; | |
const REDIS_URL: string = process.env.REDIS_URL ?? ""; |