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
// | |
// NewModel.swift | |
// Susi | |
// | |
// Created by Chashmeet Singh on 2017-06-08. | |
// Copyright © 2017 FOSSAsia. All rights reserved. | |
// | |
import RealmSwift | |
import Realm |
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
def naked_twins(values): | |
"""Eliminate values using the naked twins strategy. | |
Args: | |
values(dict): a dictionary of the form {'box_name': '123456789', ...} | |
Returns: | |
the values dictionary with the naked twins eliminated from peers. | |
""" | |
twins = [] |
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
from utils import * | |
def only_choice(values): | |
for unit in unitlist: | |
for box in unitlist: | |
val = '' | |
for item in box: | |
if len(values[item]) > 1: | |
val += values[item] | |
s = '' |
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
List<NameValuePair> someVariable = new ArrayList<NameValuePair>(); | |
nameValuePairs.add(new BasicNameValuePair("query", "{articles{id}}")); | |
HttpClient httpclient=new DefaultHttpClient(); | |
HttpPost httppost = new HttpPost("http://udacity-alumni-api.herokuapp.com/graphql"); | |
httppost.setHeader(HTTP.CONTENT_TYPE,"application/x-www-form-urlencoded;charset=UTF-8"); | |
try { | |
httppost.setEntity(new UrlEncodedFormEntity(someVariable, "UTF-8")); | |
} catch (UnsupportedEncodingException e) { |
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
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 24 | |
buildToolsVersion "24.0.2" | |
defaultConfig { | |
applicationId "jp.ogwork.freetransform" | |
minSdkVersion 15 | |
targetSdkVersion 24 |
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
func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String { | |
let calendar = Calendar.current | |
let now = NSDate() | |
let earliest = now.earlierDate(date as Date) | |
let latest = (earliest == now) ? date : now | |
let components:NSDateComponents = calendar.components([Calendar.Unit.minute , Calendar.Unit.hour , Calendar.Unit.day , Calendar.Unit.weekOfYear , Calendar.Unit.month , Calendar.Unit.year , Calendar.Unit.second], from: earliest, to: latest as Date, options: Calendar.Options()) | |
if (components.year >= 2) { | |
return "\(components.year) years ago" | |
} else if (components.year >= 1){ |
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
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
let navigationController: AppNavigationController = AppNavigationController(rootViewController: VideoViewController()) | |
let menuViewController: AppMenuController = AppMenuController(rootViewController: navigationController) | |
menuViewController.edgesForExtendedLayout = .None | |
let tabBarController: BottomNavigationController = BottomNavigationController() | |
tabBarController.viewControllers = [RecipesViewController(), menuViewController, PhotoViewController()] | |
tabBarController.selectedIndex = 1 | |
tabBarController.tabBar.tintColor = MaterialColor.white |
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 UIKit | |
import SpriteKit | |
import ParticlesLoadingView | |
class ViewController: UIViewController { | |
lazy var loadingView: ParticlesLoadingView = { | |
let x = UIScreen.mainScreen().bounds.size.width / 2 - (75 / 2) - 200 | |
let y = UIScreen.mainScreen().bounds.size.height / 2 - (75 / 2) | |
let view = ParticlesLoadingView(frame: CGRect(x: x, y: y, width: 75, height: 75)) |
NewerOlder