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
(base) ➜ test-sparse-checkout git:(main) ✗ la | |
total 0 | |
drwxr-xr-x 5 townie user 160 Mar 14 19:35 . | |
drwxr-xr-x 14 townie user 448 Mar 14 07:45 .. | |
drwxr-xr-x 13 townie user 416 Mar 14 07:35 .git | |
-rw-r--r-- 1 townie user 0 Mar 14 07:35 .gitignore | |
-rw-r--r-- 1 townie user 0 Mar 14 07:26 text.txt | |
# Clone a repo I want to sparse checkout | |
(base) ➜ test-sparse-checkout git:(main) ✗ git clone \ |
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 SanitizeThat { | |
public static String sanitizeIntegerToString(String input) { | |
if (input == null) | |
return ""; | |
String result = ""; | |
// Rule: Only digits except for "%" and "_" | |
result = input.replaceAll("[^\\d\\%\\_]", ""); | |
result = stripInvalidWildcards(result); |
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 TicTacToe extends JFrame { | |
private boolean initialized; // Default = false | |
private XOButtons buttons; | |
private int scorePlayer1; | |
private int scorePlayer2; | |
// Reset the board | |
// Reset the markers, etc. | |
public void resetGame() { |
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
# Create a dictionary with one key-value pair | |
d = dict() | |
d["ABS"] = "Anti-lock Braking System" | |
# The previous block could be simplified to: | |
# d = {"ABS": "Anti-lock Braking System"} | |
# Get input from user | |
s = input("Enter something: ") |
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 random import choice | |
class board: | |
_HANGMAN = ( | |
""" | |
------ | |
| | | |
| |
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
namespace YouNameThisNamespace | |
{ | |
public class ExampleClass | |
{ | |
public static int GetGCF(int num1, int num2) | |
{ | |
// Declare variables | |
int a = num1; | |
int b = num2; | |
int r = 0; |
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 Class1 | |
{ | |
// These are global variables | |
// because they are declared outside of all methods inside of this class. | |
// Therefore, they can be accessed in any functions defined in this class. | |
public int GlobalIntVariable; | |
public string GlobalStringVariable; | |
public void Foo() |
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 AnObject | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public AnObject(int id, string name) | |
{ | |
this.Id = id; | |
this.Name = name; | |
} |
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 LinqExample | |
{ | |
public static void Main(String[] args) | |
{ | |
List<SomeMap> mapList = new List<SomeMap>(); | |
mapList.Add(new SomeMap(1, "Main Office")); | |
mapList.Add(new SomeMap(2, "Bedroom")); | |
mapList.Add(new SomeMap(3, "Art Room")); |
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; | |
namespace StackOverflow.Playground | |
{ | |
public class GetSetExample | |
{ | |
public static void Main(String[] args) | |
{ | |
// I am creating an instance of a class or in C# term, an entity or a view model. | |
Something sv = new Something(); |
NewerOlder