Skip to content

Instantly share code, notes, and snippets.

View ChrisMissal's full-sized avatar
💭
set status

Chris Missal ChrisMissal

💭
set status
View GitHub Profile
@ChrisMissal
ChrisMissal / convert_gists.rb
Last active December 19, 2015 02:09
Rake task to convert gists from one format to another
desc "Convert old gist tags into new format"
task :convert_gists, :dir do |t, args|
puts ">>> !! Please provide a directory, eg. rake convert_gists[source/_new_posts]" unless args.dir
if args.dir
if args.dir == "/"
dir = ""
else
dir = args.dir.sub(/(\/*)(.+)/, "\\2").sub(/\/$/, '');
end
Dir.open dir do |d|
@ChrisMissal
ChrisMissal / Extensions.cs
Created June 17, 2013 18:18
Recursively fetch the first non-null ancestor.
public static T GetFarthestAncestor<T>(this T self, Func<T, T> ancestorSelector)
{
var parent = ancestorSelector(self);
return parent != null
? GetFarthestAncestor(parent, ancestorSelector)
: self;
}
@ChrisMissal
ChrisMissal / ValueObject.cs
Created June 5, 2013 16:06
ValueObject<T>
[Serializable]
public abstract class ValueObject<T> : IEquatable<T> where T : class
{
public override bool Equals(object obj)
{
if (obj == null)
return false;
var other = obj as T;
@ChrisMissal
ChrisMissal / notes.md
Created April 10, 2013 20:28
Why I prefer git over svn. (Too much for twitter)

Why I prefer git over svn

  1. Branching in svn and git are both easy, but merging is much easier in git. I have spent lots of time merging in svn.
  2. Being able to commit locally without being connected compliments my workflow. I can push several commits to "master" when I'm done and not one giant commit all at once.
  3. Lots of history in svn takes up a lot more space than git
  4. Rebasing and cherry-picking in git makes hot-fixes much more easy than in svn.
  5. Pulling/fetching source code is much quicker in git than svn.

These are just a few that come to mind that wouldn't fit in a tweet :)

@ChrisMissal
ChrisMissal / Formo.cs
Last active December 14, 2015 00:49
When requesting values from ConfigurationManager.AppSettings, all values come back as strings. You can use Formo to shortcut this using a typed method.
dynamic config = new Configuration();
// returns 5 as a string (see app.config file)
var retryAttempts1 = config.RetryAttempts;
// returns 5 if found in config, else 10
var retryAttempts2 = config.RetryAttempts(10);
// returns 5 if it exists in config, else userInput if not null, else 10
var retryAttempts3 = config.RetryAttempts(userInput, 10);
@ChrisMissal
ChrisMissal / wtf.md
Last active December 12, 2015 06:49
This was posted as a comment for this post: http://chrismissal.wordpress.com/2012/04/17/more-of-chris/

This was a comment for this post: http://chrismissal.wordpress.com/2012/04/17/more-of-chris/

When I moved to San Francisco in 2007, I knew it wouldn’t be cheap. Ever since I’ve been conscious of phrases like “cost of living” and “quality of life,” I’ve understood that this is an expensive city. But I had been living in Los Angeles and was coming up here for research on a novel that I was writing, and I fell head over heels in love with the city. There was no going back. So I found a job, packed up, and took some crappy apartment in the Lower Haight that pushed the boundary of my nonprofit salary. The place was beyond gross. There was cat food stuck in the old, dingy carpets. Human feces often

@ChrisMissal
ChrisMissal / blog-engine.md
Last active December 12, 2015 06:19
These are the things I want in a blog engine. I'm tempted to write one myself because I feel the ease of use will let me blog more often.

Chris Missal's Unnamed and Opinionated Blog Engine


The purpose of these requirements are to define a blog engine that is perfect for me. I don't need many features, I just want to blog about code and tech things.

This project should be language agnostic in that I don't care what is used to build it. I'm really looking at it from a user perspective, not a developer. However, the idea of being able to type on one side of the screen and see a live preview of my formatted markdown on the other is most important and I think could be shared as a separate open source project. Again... all just thoughts right now.

Reasons:

  1. I feel like blogging engines have too much "junk" in them. They distract me too often because they're trying to be a full-blown CMS. I would rather focus on content and writing than page/category/tag management.
@ChrisMissal
ChrisMissal / css-comments.css
Created February 2, 2013 17:23
You could search your CSS for rules that involve users or comments. The ^ makes it easier to find those tags.
/**
* #.# Section title
*
* @tags ^users ^comments
*
* @description Description of section, whether or not it has media queries, etc.
*/
.selector {
float: left;
@ChrisMissal
ChrisMissal / Program.cs
Created January 30, 2013 06:23
This shows how Palmer and TempusReader can play nicely together!
class Program
{
private static int attempts = 0;
static void Main(string[] args)
{
Retry.On<Exception>().For("2.5 seconds".InTime()).With(context =>
{
Program.SendRequest();
});
@ChrisMissal
ChrisMissal / extending-objects-in-dojo-1.js
Created September 28, 2012 00:03
Extending objects in Dojo
var start = {
id: 123,
count: 41,
desc: 'this is information',
title: 'Base Object',
tag: 'uncategorized',
values: [1,1,2,3,5,8,13]
};
var more = {
name: 'Los Techies',