Skip to content

Instantly share code, notes, and snippets.

@idavis
idavis / gist:1303952
Created October 21, 2011 14:13
If have the values...or not
// Variable names have been changed to protect the guilty. Class and method names are real.
//If have the values, set foo and bar
if (!false)
{
CommonFunctions.SetFieldValue(row, "foo", foo);
}
if (!false)
{
var codingMusic = from music in AllMusic
where !music.ContainsGrowling
where ( !music.IsInEnglish || music.HasNoLyrics )
where music.Genres.Contains( "Metal", "FolkMetal" )
where HasTalent( music.Artist )
select music;
@idavis
idavis / Settings.cs
Created November 13, 2011 05:05
settings example
// pulls the values from the configuration file
// you can have a separate config file per env
// Environment is a value set in the config file that ConfigurationBase uses to determine default values with the Default() method.
public class ServicesConfig : ConfigurationBase
{
public Uri WebServer
{
get { return Get(()=> WebServer, Default("DevDefault", "TestDefault", "ProdDefault")); }
}
@idavis
idavis / after.ps
Created November 28, 2011 17:55
Still needs work, but which is more readable
function Get-XADUserPasswordExpirationDate {
param ([Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, HelpMessage="Identity of the Account")]
$accountIdentity)
$accountObj = Get-ADUser $accountIdentity -properties PasswordExpired, PasswordNeverExpires, PasswordLastSet
if ($accountObj.PasswordExpired) {
Write-Host ("Password of account: $($accountObj.Name) already expired!")
return
}
@idavis
idavis / UnitCircleSampler.cs
Created February 12, 2012 22:31
Generate Random Points Within a Unit Circle
public void Sample()
{
for ( int i = 0; i < 100; i++ )
{
Console.WriteLine(Locator.GetLocationNear());
}
}
using System;
@idavis
idavis / .autotest
Created February 14, 2012 16:56
Config settings for continuous js testing
require 'autotest/growl'
require 'autotest/fsevent' if RUBY_PLATFORM =~ /darwin/
@idavis
idavis / LateToTheParty.cs
Created February 15, 2012 18:46
True Late Binding
public class Foo {
public void Bar() {
if(IsBaz()) {
Console.WriteLine("CRAP");
} else {
Console.WriteLine("W00T");
}
}
public bool IsBaz() {
@idavis
idavis / fubar.nuspec
Created March 6, 2012 02:02
Tools scripts do not work unless ANSI encoded
<?xml version="1.0"?>
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Issue1949</id>
<version>0.2.2</version>
<authors>Ian Davis</authors>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<licenseUrl>https://raw.github.com/idavis/Toji/master/LICENSE.txt</licenseUrl>
<description>Toji is a bootstrapping project for setting up psake builds.</description>
<summary>Custom brewed psake goodness</summary>
@idavis
idavis / gist:2206574
Created March 26, 2012 17:14
Building fubumvc after a clone
C:\dev\fubumvc [master]> rake
rake aborted!
Run `git submodule update --init` to populate your buildsupport folder.
(See full trace by running task with --trace)
C:\dev\fubumvc [master +0 ~0 -1]> git submodule update --init
Submodule 'buildsupport' () registered for path 'buildsupport'
fatal: unable to connect to github.com:
github.com[0: 207.97.227.239]: errno=No error
@idavis
idavis / gist:3012980
Created June 28, 2012 18:08
Trying to work with Samsung support when Kies was constantly crashing after an update.
Please wait for a Samsung Agent to respond.
You are now chatting with 'Suzanne'. There will be a brief survey at the end of our chat to share feedback on my performance today.
Your Issue ID for this chat is LTK5640844954X
Suzanne: Hi, thank you for contacting Samsung Technical Support. How may I help you today?
Visitor: I have a galaxy s2 SGH-T98
Suzanne: Please let me know how I may help you.
Visitor: I downloaded kies Kies_2.1.0.11112_41_7 from the device support site
Visitor: when I start the app. it instantly crashes every time with a MemoryAccessViolationException
Suzanne: Please let me know the issue, so that I can help you.
Visitor: I can pull out the stack track from Visual Studio if you like