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/python | |
# -*- coding: UTF-8 -*- | |
# battleship game | |
import sys | |
import random | |
def is_valid_int(integer): | |
""" | |
checks to see if number represents a valid integer |
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
# play the game of connect 4 | |
def make_board(): | |
""" | |
create the blank connect game board | |
It's a list of list 6 X 7 | |
@returns: the board created(list) | |
""" | |
board = [] |
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
# play the battleship game | |
import sys | |
import random | |
def is_valid_int(integer): | |
""" | |
checks to see if number represents a valid integer | |
@number: a string that might represent an integer | |
@returns: true if the string represents an integer |
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
/* | |
* reverse_int.c | |
* | |
* | |
* Read an integer from stdin, reverse it, | |
* and print if back to the user. | |
*/ | |
#include <ctype.h> | |
#include <stdlib.h> |
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
/* | |
* sort_lines.c | |
* | |
* | |
* Read in an array of lines from stdin, sort them , | |
* and print the sorted strings back. | |
*/ | |
#include <ctype.h> | |
#include <stdlib.h> |
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
/* | |
* get_string.c | |
* | |
* | |
* Read a string from stdin, | |
* store it in an array, | |
* and print it back to the user. | |
*/ | |
#include <ctype.h> |
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
editor | |
foreground: F5F5F5 | |
background: 1B1E1C | |
caret: AF5F00 | |
editor-selection | |
foreground: FFFFFF | |
background: 3E3E3E | |
H1 |
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
#!/bin/sh | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 Author-Name" | |
exit 1 | |
fi | |
echo Total Commit: $(git log --author=$1 --pretty=tformat: --oneline | wc -l) | |
git log --author=$1 --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "Added lines: %s, Removed lines: %s, Total lines: %s\n", add, subs, loc }' |
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
/* | |
* is_palindrome.c | |
* | |
* | |
* Read an input from stdin, print it back to the user and | |
* report if it is a palindrome. | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> |
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
# 需要检查的 gem 以及对应的版本 | |
requireGems = { | |
'psych' => '>= 2.1', | |
} | |
# cocoapods & psych | |
requireGems.each do |gem_name, gem_ver_reqs| | |
gdep = Gem::Dependency.new(gem_name, *gem_ver_reqs) | |
found_gspec = gdep.matching_specs.max_by(&:version) | |
if found_gspec |
OlderNewer