View debug-stdin.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
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() |
View gist:f486a421110b78ed95137d3eb805c61e
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 |
View gist:ef0f5e5e0a7bad4d1f411f0d03f7e7e5
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"); | |
} | |
} |
View gist:e2c548b6b9e80fe943c2b1d1d2089d2e
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"); | |
} |
View gist:cceb2397b8cd7d6c3b2ca27442148ee2
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 |