Skip to content

Instantly share code, notes, and snippets.

View varjmes's full-sized avatar
🏳️‍🌈

James varjmes

🏳️‍🌈
View GitHub Profile
@varjmes
varjmes / returnoftheelderlywoman.js
Last active December 24, 2015 06:29
Playing with Switch & Case Statements.
var user = prompt("An elderly lady approaches you, brandishing a sharpened umbrella. Do you FIGHT, do you RUN or do you CURL up into the fetal position?").toUpperCase();
switch(user) {
case 'FIGHT':
console.log("You'd really hurt an old lady? For shame.");
var hits = prompt("How many times will you hit her?");
var sure = prompt("Are you sure?").toUpperCase();
if (hits >= 1 && sure === 'YES') {
console.log("How Heinous. She's dead. And you're a bad person.");
} else if (hits === 0 || sure === 'NO' ) {
@varjmes
varjmes / rockpaperscissors.js
Last active December 23, 2015 16:49
Rock, Paper, Scissors -> Is there a simpler way to do this?
var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
}
// Check if the player is ready to play!
confirm("Are you ready to begin?");
// How old is the player?
var age = prompt("How old are you?");
if (age < 18) {
console.log("Fine, you can play, but I'm not responsible for you.");
} else {
console.log("Let's go!");
@varjmes
varjmes / gist:5694853
Created June 2, 2013 20:31
Tiny text-based adventure game I wrote in Ruby today. Spoilers: You die.
def prompt
print("> ")
end
puts("You enter a dark room with two doors. Do you go through door #1 or #2?")
prompt; door = gets.chomp
if door == "1"
puts("You walk towards door #1")
@varjmes
varjmes / theendingisalwaysdeath.rb
Last active December 18, 2015 00:09
Tiny text-based adventure game written in Ruby.
def prompt
print("> ")
end
puts("You enter a dark room with two doors. Do you go through door #1 or #2?")
prompt; door = gets.chomp
if door == "1"
puts("You walk towards door #1")

Keybase proof

I hereby claim:

  • I am charlotteis on github.
  • I am charlotteis (https://keybase.io/charlotteis) on keybase.
  • I have a public key whose fingerprint is 0DD4 948C 7BDF 5E30 38AD 57B1 4F43 DCA1 1236 8D47

To claim this, I am signing this object:

@varjmes
varjmes / Testing.js
Created May 20, 2015 12:18
Testing!
console.log("Test!");
@varjmes
varjmes / humansize.py
Created December 28, 2014 12:48
humansize.py
SUFFIXES = {1000: ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
1024: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']}
def approximate_size(size, a_kilobyte_is_1024_bytes=True):
"""Convert a file size to human-readable form.
Keyword arguments:
size -- file size in bytes
a_kilobyte_is_1024_bytes -- if True (default), use multiples of 1024,
if False, use multiples of 1000
Opera has modified script or content on www.youtube.com (PATCH-1185, youtube.com - show video above playlist). See browser.js for details
Front-End London - https://www.youtube.com/playlist?list=PLOSHQ_hfikSoJ2tOfCheuiPcEcbSa7WpO
XOXO Fest - https://www.youtube.com/user/xoxofest
Generate - http://www.generateconf.com/videos
Lots of stuff from the jQuery Cons - https://www.youtube.com/channel/UCDT2QjewZ8DHsiaDXQFkxPg
Lots of stuff from JS Confs & CSS Conf EU - https://www.youtube.com/user/jsconfeu
Sass Conf 2013 - https://www.youtube.com/playlist?list=PLXrTmSPkhnXsd_MGL5Y__7IoRemarkRVi