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 Clock extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {date: new Date()}; | |
} | |
componentDidMount() { | |
this.timerID = setInterval( | |
() => this.tick(), | |
1000 |
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
using System; | |
using System.Text.RegularExpressions; | |
public class Kata | |
{ | |
public static string CreatePhoneNumber(int[] numbers) => | |
new Regex("(...)(...)(....)").Replace(String.Concat(numbers), "($1) $2-$3"); | |
} |
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 class Kata | |
{ | |
public static string CreatePhoneNumber(int[] numbers) | |
{ | |
return long.Parse(string.Concat(numbers)).ToString("(000) 000-0000"); | |
} | |
} |
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 reverse_word_order(text): | |
newText = "" | |
position = 0 | |
for t in text: | |
if t == " ": | |
newText = text[position:text.find(t, position)] + " " + newText | |
position = text.find(t, position) + 1 | |
newText = text[position:] + " " + newText |
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 sys | |
s = input() | |
# pdb uses stdin to be interactive; this switches stdin to be the teletype interface | |
# (terminal and keyboard) after getting the redirected input | |
sys.stdin = open("/dev/tty") | |
breakpoint() |