Skip to content

Instantly share code, notes, and snippets.

View hagbarddenstore's full-sized avatar

Kim Johansson hagbarddenstore

View GitHub Profile
@hagbarddenstore
hagbarddenstore / Doge-git.sh
Created January 10, 2014 12:44
Written by @chris__martin
#!/bin/sh
alias such = git
alias very = git
alias wow = 'git status'
# wow
# such commit
# very push
void Main()
{
Expression<Func<Article, bool>> expression = a => a.Title == "Something";
Console.WriteLine(expression.NodeType);
var lambdaExpression = (LambdaExpression)expression;
Console.WriteLine(lambdaExpression.Body.NodeType);
void Main()
{
var a = new List<List<int>>
{
new List<int> { 1, 2, 3 },
new List<int> { 4, 5, 6, 7, 8, 9 }
};
Console.WriteLine(a.Count);
Console.WriteLine(a[0].Count);
protected function getParameterAs($key, $type, $default = null, $validation = ValidationType::None, $validationData = null)
{
if (!isset($this->passedArgs[$key]))
{
return $default;
}
// NOTE: Not sure if this is needed, my PHP-fu is weak.
$value = null;
// Variant 1
var lines = File.ReadAllLines("in.txt");
var output = new StringBuilder();
foreach (var line in lines)
{
if (ShouldUseThisLine(line))
{
output.AppendLine(line);
class AlbumCollection
{
public List<Album> Albums { get; set; }
}
class Album
{
public int Id { get; set; }
public string Name { get; set; }
}
xbuild Kumiko.Todo.sln /t:Rebuild /p:SolutionDir=/home/hagbard/projects/Kumiko.Todo/ /p:Configuration=Debug /verbosity:diagnostic
// In BusinessLayer.dll
using System;
public class User
{
public User(string username)
{
Id = Guid.NewGuid();
CreatedOn = DateTime.UtcNow;
Username = username;
void Main()
{
var list = new List<int> { 1, 2, 3, 4, 5, 6 };
var sumOfAllItems = list.Sum(_ => Print(_));
Console.WriteLine(sumOfAllItems);
}
static int Print<T>(T item)
private IEnumerable<DataRow> RetrieveVendor(string table, string system, string region, params string[] fields)
{
var table = new DataTable();
var databaseFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "inu.db3");
if (!System.IO.File.Exists(databaseFile))
{
MessageBox.Show(string.Format("I couldn't find the file `{0}'!", databaseFile));
}