Skip to content

Instantly share code, notes, and snippets.

View sometowngeek's full-sized avatar

Robert sometowngeek

View GitHub Profile
@sometowngeek
sometowngeek / AttendanceList.cs
Last active February 24, 2018 18:32
CRUD for someone on SO
using System;
namespace StackOverflow.Playground
{
public class AttendanceList
{
public Guid CommunityEventAttendanceListId { get; set; }
public Guid CommunityEventId { get; set; }
}
@sometowngeek
sometowngeek / Point.cs
Last active February 24, 2018 18:32
Point.cs for someone on SO
using System;
namespace StackOverflow.Playground
{
public class Point
{
public static void Main(String[] args)
{
Xcoord xc = new Xcoord();
@sometowngeek
sometowngeek / Point2.cs
Last active February 24, 2018 18:33
Point2.cs for someone on SO
using System;
namespace StackOverflow.Playground
{
public class Point2
{
// This is using the Xcoord as an entity outside of this class.
public static void Main(String[] args)
{
Xcoord xc = new Xcoord();
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();
@sometowngeek
sometowngeek / LinqExample.cs
Last active February 24, 2018 18:34
LINQ Example
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"));
@sometowngeek
sometowngeek / AnObject.cs
Last active February 24, 2018 18:35
Indexer Example
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;
}
@sometowngeek
sometowngeek / Class1.cs
Last active February 24, 2018 18:30
Scoping Example
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()
namespace YouNameThisNamespace
{
public class ExampleClass
{
public static int GetGCF(int num1, int num2)
{
// Declare variables
int a = num1;
int b = num2;
int r = 0;
@sometowngeek
sometowngeek / board.py
Last active February 24, 2018 18:24
More OOP-like version of Hangman
from random import choice
class board:
_HANGMAN = (
"""
------
| |
|
# 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: ")