Skip to content

Instantly share code, notes, and snippets.

import "regexp"
var r, _ = regexp.Compile("\\\\|/|:|\\*|\\?|<|>")
// MakeFilenameWindowsFriendly removes characters not permitted in file/directory names on Windows
func MakeFilenameWindowsFriendly(name string) string {
return r.ReplaceAllString(name, "")
}
import (
"path"
"path/filepath"
)
func GetFullPath(filename string) string {
// baseDir to be some base directory
return filepath.FromSlash(path.Join(baseDir, filename))
}
@ranskills
ranskills / BusinessCalendar.php
Created December 11, 2018 21:05
Calculates the next or prior business days(s) factoring in holidays
<?php
class BusinessCalendar
{
private $debugMessage;
private $debug = false;
public function __construct($debug = false)
{
$this->debug = $debug;
@ranskills
ranskills / gpa_calculator.js
Created March 28, 2012 22:45
GPA Calculator In JavaScript
var gradeLetters = ['a', 'b+', 'b', 'c+', 'c', 'd', 'f', 'af', 'wf'],
gradePoints = [4, 3.5, 3, 2.5, 2, 1, 0, 0, 0];
function getNumCoursesToBeEntered() {
"use strict";
var numCourses = 0,
input = "";
do {
input = prompt("Enter number of subjects?");