Skip to content

Instantly share code, notes, and snippets.

View cmjaimet's full-sized avatar

Charles Jaimet cmjaimet

  • PIPSC
  • Ottawa
View GitHub Profile
@cmjaimet
cmjaimet / even-odd-js.markdown
Last active February 19, 2019 16:03
Even/Odd JS
@cmjaimet
cmjaimet / server.js
Created February 19, 2019 16:10
Very simple Node server
/**
* VERY simple web server in Node with limited/no error trapping
*/
var http = require( 'http' );
var fs = require( 'fs' );
const PORT = 8080;
function handleRequest( req, res ){
var url = '/index.html'; // default path
@cmjaimet
cmjaimet / index.html
Created February 19, 2019 16:20
Letters (JS)
<h2>Count letters in text</h2>
<p>Enter some text and watch the script count each letter in it, and return as a sorted list, most common first.</p>
<form>
<textarea style="width:90%;height:400px;" id="para"></textarea>
</form>
<ul id="alpha"></ul>
@cmjaimet
cmjaimet / index.html
Created February 19, 2019 16:24
zebqNv
<h2>Convert camel case to snake case</h2>
<p>Enter a camel case string.</p>
<form>
<input type="text" id="camel" value="camelCaseWord" />
<button id="butn" type="button">Go!</button>
</form>
<div id="output"></div>
@cmjaimet
cmjaimet / hangman.rb
Last active February 20, 2019 19:32
Minimal ruby class
class Hangman
attr_reader :answer # creates getter method so class property is not accessed directly as data
def initialize()
@answer = get_answer # set the value of the class property
end
def get_answer()
puts "Enter Answer:" # prints a prompt to the screen
gets.chomp.upcase # gets the input from user and converts it to uppercase - convert later to a method to validate format (/[a-zA-Z ]{3,30}/)
end
end