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/env python2.7 | |
# README: | |
# So this puppy won't run as is. | |
# I've commented out the LogAdapter lines that assign | |
# the logger var. This is because I strongly, strongly | |
# recommend you have good logging, take the time to | |
# setup your logger properly, and customize your | |
# own logging format. Your operations folks will | |
# thank you (assuming you log useful stuff). |
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 Root(Resource): | |
baseLogger = None | |
def __init__(self): | |
self.baseLogger = logging.getLogger('MB-Server.Root') | |
logger = MBLogAdapter(self.baseLogger, {'file': 'main.tac', 'object': 'Root', 'method': '__init__'}) | |
logger.info('Creating new Root') |
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
var x = prompt("Type something at me"); | |
if (x.indexOf("1") != -1 && x.indexOf("$") != -1 ) { | |
alert("You entered both a 1 and a $."); | |
} else if ( x.indexOf("1") != -1 ) { | |
alert("You entered only a 1"); | |
} else if ( x.indexOf("$") != -1 ) { | |
alert("You entered only a $"); | |
} else { | |
alert("Congrats you entered neither a 1 nor a $."); |
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
var obj = {}; | |
obj.a = 1; | |
obj.b = 2; | |
var reallyA = "a" | |
console.log("obj.a: " + obj.a); | |
console.log("obj['a']: " + obj["a"]); | |
console.log("obj[reallyA]: " + obj[reallyA]); |
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 | |
# | |
# Pulled from https://www.nginx.com/resources/wiki/start/topics/examples/redhatnginxinit/ 2016-02-14 | |
# | |
# nginx - this script starts and stops the nginx daemon | |
# | |
# chkconfig: - 85 15 | |
# description: NGINX is an HTTP(S) server, HTTP(S) reverse \ | |
# proxy and IMAP/POP3 proxy server | |
# processname: nginx |
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 java.util.List; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
public class Parent { | |
private List<String> collection; | |
public Parent(List<String> stuff) { | |
collection = new ArrayList<>(); | |
for(String item : stuff) { |
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 class called LTCMath with a typical main function. | |
Create a public static function called printSquare that takes in one integer and returns no output. printSquare should print a square whose sides are the length of the integer parameter. | |
Create a public static function called getEven that takes in an integer array. It should return an array consisting of only the even numbers from the given array. | |
Create a unit test for getEven. Test it for a normal array, an empty array, an array of only even numbers, and an array of only odd numbers. | |
Create a second class called Converter. |
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 Main { | |
public static void main(String[] args) { | |
String testString = "forrk"; | |
String validString = "fork"; | |
char currentChar; | |
StringBuilder builder = new StringBuilder(testString); | |
for(int i = 0; i < testString.length(); i++) { | |
currentChar = builder.charAt(i); | |
builder.deleteCharAt(i); | |
System.out.println("Current String: " + builder.toString()); |
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 function called print_square that takes in one integer and returns no output. print_square should print a square whose sides are the length of the integer parameter. | |
Create a function called get_even that takes in a list of numbers. It should return a list consisting of only the even numbers from the given list. | |
Create a function to test get_even. It should call get_even with a normal array, an empty array, an array of only even numbers, and an array of only odd numbers as inputs. If it fails to behave as expected, throw an error. | |
Create a function called convert_c_to_f. It should take in a number as its only parameter. It should return a number that converts the given number from Celsius degrees to Farenheit degrees. The formula for Celsius to Farenheit: Tc * (9/5) + 32. | |
Call print_square with 5 as an input. | |
Call convert_c_to_F with today's temperature and print it out. |
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
/* | |
PROGRAM STRUCTURE | |
Things in <>'s are meant to be replaced. | |
import <my import>; | |
public class <ClassName> { | |
public static void main(String[] args) { | |
// logic | |
} |
OlderNewer