Skip to content

Instantly share code, notes, and snippets.

@samisnotinsane
samisnotinsane / human.dart
Created May 9, 2020 17:15
Constructors in Dart
void main() {
Human jenny = Human(height: 145, weight: 47);
print(jenny.height);
print(jenny.weight);
Human sam = Human(height: 166, weight: 71);
print(sam.height);
print(sam.weight);
}
@samisnotinsane
samisnotinsane / click-hello.py
Last active February 25, 2020 23:17
An example click command line application with options, arguments and context.
import click
class Config(object):
def __init__(self):
self.verbose = False
pass_config = click.make_pass_decorator(Config, ensure=True)
@samisnotinsane
samisnotinsane / rot13.py
Created August 28, 2018 21:44
Reads contents from a text file and performs a rot13 encode on letters from the English alphabet.
def join_letters_to_string(chars):
s = ""
for c in chars:
s += c
return s
def rotate(letter, position):
# Assumptions:
# -input is a letter (i.e. length = 1)
# -input is an alphabetical character (i.e. no punctuations)
@samisnotinsane
samisnotinsane / matrix_experiments.py
Created August 1, 2018 13:30
Manipulation and pattern recognition within a matrix. With six different examples.
# S. No, Student Name, Science, English, History, Arts, Maths
classroom = [ [1, 'Roy', 80, 75, 85, 90, 95],
[2, 'John', 75, 80, 75, 85, 100],
[3, 'Dave', 80, 80, 80, 90, 95]]
print('[OUT] E.g. 0')
print(classroom)
print('Pretty print: ' + '\n' + '---------')
for student in classroom:
# print(len(student))
@samisnotinsane
samisnotinsane / README-Template.md
Created April 17, 2018 09:41 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@samisnotinsane
samisnotinsane / DocumentTreeExample.java
Created April 10, 2018 23:19
Creating a DOM tree from scratch using Java DOM API.
import java.util.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.Element;