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 Door { | |
public Door(bool closed, bool hasNotInUseSign) { | |
this.InUse = closed; | |
this.HasNotInUseSign = hasNotInUseSign; | |
} | |
public State State => this.GetState(); | |
private State GetState() { | |
if (InUse && !HasNotInUseSign) { |
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 perl | |
$no_of_args = @ARGV; | |
$expand_size = 5; | |
$max_width = 10; | |
if(($no_of_args == 0) || ($no_of_args == 2)) | |
{ | |
print "ERROR: Insufficient argument\n"; | |
goto help; |
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/bash | |
DIRECTORY=$1 | |
DIRECTORY="${DIRECTORY%/}"; | |
echo $DIRECTORY | |
echo "tarring up the following directory /web/htdocs/$DIRECTORY" | |
tar -cvpf "/web/htdocs/$DIRECTORY/$DIRECTORY.`date -u +%Y-%m-%d.%H.%M.%S`.tar" "/web/htdocs/$DIRECTORY/" > /dev/null | |
if [ ! -d "/web/htdocs/backups/$DIRECTORY" ]; then |
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
function post(path, params, method) { | |
method = method || "post"; // Set method to post by default if not specified. | |
// The rest of this code assumes you are not using a library. | |
// It can be made less wordy if you use one. | |
var form = document.createElement("form"); | |
form.setAttribute("method", method); | |
form.setAttribute("action", path); | |
for(var key in params) { |
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 os | |
import subprocess | |
import shlex | |
def bail_if_another_is_running(): | |
cmd = shlex.split("pgrep -u {} -f {}".format(os.getuid(), __file__)) | |
pids = subprocess.check_output(cmd).strip().split('\n') | |
if len(pids) > 1: | |
pids.remove("{}".format(os.getpid())) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Bar Test</title> | |
<style type="text/css"> | |
body { | |
font-family: Helvetica, sans-serif; | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
perl -ni -e 'print unless $. == 1' [filename] |
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
sudo apt-get install npm | |
sudo npm cache clean -f | |
sudo npm install -g n | |
sudo n stable | |
node -v | |
v5.0.0 |