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 ruby | |
def main() | |
n = ARGV.first.to_i | |
array = [] | |
for i in 1..n | |
array << rand(1..n) | |
end | |
start_t = Time.now | |
merge_sort(array) |
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
require 'launchy' | |
EXTENSIONS = /^.*\.(jpg|png|gif)$/i | |
STYLES = %q( | |
#images { | |
line-height: 0; | |
-webkit-column-count: 5; | |
-webkit-column-gap: 5px; | |
-moz-column-count: 5; |
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
isPrime :: Integer -> Bool | |
isPrime x = all (==True) [ x `mod` y /= 0 | y <- [2..x-1]] | |
primes = [ x | x <- [1..], isPrime x ] |
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
/* | |
* https://blogs.msdn.microsoft.com/sriram/2005/08/07/functional-programming-in-c-currying/ | |
*/ | |
public class Lambda | |
{ | |
public delegate T Function<T, U>(params U[] args); | |
public static Function<K, J> Curry<K, J>(Function<K, J> func, params J[] curriedArgs) | |
{ |
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
require 'csv' | |
DEFAULT_SPLIT_RATIO = 0.66 | |
def main | |
fileName, k, userSplit = ARGV | |
splitRatio = userSplit.nil? ? DEFAULT_SPLIT_RATIO : userSplit.to_f | |
trainSet, testSet = loadData(fileName, splitRatio) | |
predictions = Array.new | |
testSet.each do |testInstance| |
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
using System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.IO; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Mvc; | |
namespace ControllerInfrastructure | |
{ |
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
git config --global alias.standup 'log --pretty="%C(red)%an%Creset %C(green)%ad%Creset | %s%C(yellow)%d%Creset" --since=yesterday --all --reverse --date="format:%d/%m %a %T" --author="Your Name"' |
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
-- =============================================== | |
-- Create SQL Login template for Windows Azure SQL Database | |
-- reference: https://azure.microsoft.com/en-us/blog/adding-users-to-your-sql-azure-database/ | |
-- =============================================== | |
-- The SQL Server administrative login needs to be conected to the master database to execute CREATE LOGIN command | |
USE [master] | |
GO | |
-- Create a login that can connect to the SQL server |
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 static class YCombinator<T> { | |
delegate Func<T, T> Recursive(Recursive recursive); | |
public static Func<Func<Func<T, T>, Func<T, T>>, Func<T, T>> Fix = | |
f => ((Recursive)(g => (f(x => g(g)(x))))) ((Recursive)(g => f(x => g(g)(x)))); | |
} |
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
using System; | |
| |
namespace Nulls | |
{ | |
public struct Maybe<T> : IEquatable<Maybe<T>> | |
where T : class | |
{ | |
private readonly T _value; | |
public T Value | |
{ |
OlderNewer