Skip to content

Instantly share code, notes, and snippets.

@archer884
archer884 / EpisodeStitcher
Created September 3, 2014 02:50
Episode stitcher togetherer
View EpisodeStitcher
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace _01_Episodes
{
@archer884
archer884 / ChoiceMaker
Last active August 29, 2015 14:07
Simplifies management and decision-making processes
View ChoiceMaker
using System;
using System.Linq;
namespace ChoiceMaker
{
class Program
{
static void Main(string[] args)
{
if (!args.Any())
View vms_analysis.fsx
open System
module Decimal =
let Zero = 0M
let One = 1M
let ceil (d: decimal): decimal = System.Math.Ceiling(d)
let floor (d: decimal): decimal = System.Math.Floor(d)
@archer884
archer884 / SortedEnumThingy
Created October 16, 2014 15:56
Victory is mine.
View SortedEnumThingy
public static MvcHtmlString SortedEnumDropDownListFor<TModel, TEnum>(
this HtmlHelper<TModel> htmlHelper,
Expression<Func<TModel, TEnum>> expression,
bool descending = false)
{
var propertyInfo = (expression.Body as MemberExpression).Member as PropertyInfo;
var options = Enum.GetValues(typeof(TEnum)).Cast<TEnum>().Select(code => new SelectListItem()
{
Selected = code.Equals((TEnum)propertyInfo.GetValue(htmlHelper.ViewData.Model)),
Text = code.ToString(),
@archer884
archer884 / PipeDownWIthArgs
Created October 22, 2014 21:59
Simple command line tool for generating HTML from Markdown
View PipeDownWIthArgs
using CommonMark;
using System;
using System.IO;
using System.Linq;
namespace PipeDown
{
class Program
{
static void Main(string[] args)
@archer884
archer884 / DateCorrector.cs
Last active August 29, 2015 14:09
Comments for YuEnDee
View DateCorrector.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
namespace EasyChallenge188_Dates
{
class Program
{
@archer884
archer884 / dice.cs
Last active August 29, 2015 14:10
Dice rolling program
View dice.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
namespace Dice
{
class Program
{
static void Main(string[] args)
@archer884
archer884 / spellcheck.rs
Created November 29, 2014 23:52
Checks files for spelling errors.
View spellcheck.rs
#![feature(phase)]
#[phase(plugin)]
extern crate regex_macros;
extern crate regex;
use regex::Regex;
use std::ascii::AsciiExt;
use std::collections::HashSet;
use std::io::{BufferedReader, File};
use std::io::fs::PathExtensions;
@archer884
archer884 / wcount.rs
Created December 1, 2014 22:10
Rust word usage counter
View wcount.rs
#![feature(phase)]
#[phase(plugin)]
extern crate regex_macros;
extern crate regex;
use regex::Regex;
use std::ascii::AsciiExt;
use std::collections::{HashMap};
use std::collections::hash_map::Entry::{Vacant, Occupied};
use std::io::{BufferedReader, File};
@archer884
archer884 / fib_seq.rs
Last active August 29, 2015 14:10
Rust fibonacci sequence
View fib_seq.rs
use std::iter::Unfold;
fn main() {
let fib_seq = Unfold::new((0i64, 1i64), |state| {
// closures pretty much always borrow, so *dereference
// to get value instead of pointer
let (x, y) = *state;
let result = Some(x);
// again, set *value, not reference