-
Take an absolute path and reduce it: /a/b/../foo.txt -> /a/foo.txt, /a/../b/./foo.txt -> /b/foo.txt
-
You are given an array representing integer. Write a function which increments this integer. Example: input [1,2,3] -> output [1,2,4] which represents 123 + 1 = 124
-
Given an unbalanced binary tree, write code to select a node at random (each node has an equal probability of being selected).
View C# Combinatorics
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
public static List<List<T>> GeneratePowerSet<T>(List<T> list) | |
{ | |
var result = new List<List<T>>(); | |
if (list.Count > 0) | |
{ | |
foreach (var t in GeneratePowerSet(list.GetRange(1, list.Count - 1))) | |
{ | |
result.Add(t); | |
var temp = DeepCopy(t); | |
temp.Add(list[0]); |
View Questions.md
View godist.rb
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
#! /usr/bin/env ruby | |
if not ARGV[0] or ARGV[0] == "-h" | |
puts "Usage: ./go_dist <project>" | |
exit | |
end | |
project_path = ARGV[0] | |
project = project_path.split('/')[-1] | |
puts "\e[1mStarting distribution of \e[32m'#{project}'\e[0m" | |
platforms = { |
View moviequote-rules.bolt
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
path /quotes { | |
write() = true; | |
read() = true; | |
} | |
path /quotes/$moviequote is Moviequote; | |
type Moviequote { | |
movie: String, | |
quote: String |
View password-keeper-rules.bolt
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
path /users/$uid { | |
read() = isCurrentUser($uid); | |
write() = isCurrentUser($uid); | |
} | |
path /users/$uid/$password is Password; | |
type Password { | |
service: String, | |
password: String, |
View weatherpics-rules.bolt
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
type Weatherpic { | |
caption: String | Null, | |
imageUrl: String, | |
uid: UserID | |
} | |
type UserID extends String; | |
path /weatherpics { | |
read() { true } |
View download-jar.py
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
#!/usr/bin/env python | |
import sys | |
import os | |
import argparse | |
from os import path | |
from os.path import isfile as exists | |
import signal | |
import json | |
import xml.etree.ElementTree as ET |
View rtdb_load.py
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
# Copyright 2017 Google Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
View Java TCP Server Wrapper
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 java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.OutputStreamWriter; | |
import java.io.PrintWriter; | |
import java.net.InetAddress; | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
import java.net.UnknownHostException; |
View MyFunctions.scala
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.google.functions.examples.scalajs | |
import scala.scalajs.js.annotation._ | |
import scala.scalajs.js | |
import js.DynamicImplicits._ | |
@js.native | |
trait Request extends js.Any { | |
val body: js.Dictionary[Any] = js.native | |
} |
OlderNewer