Skip to content

Instantly share code, notes, and snippets.

Using gpgme (1.0.9) from https://github.com/mrsimo/ruby-gpgme.git (at master) with native extensions /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for gpgme-config... no
gpgme-config not found
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
using System;
namespace ChapterOneExample. Utilities
{
public class StringUtilities
{
public int CountOccurences(string stringToCheck,
string stringToFind)
{
@royosherove
royosherove / rspecparams.rb
Created February 23, 2012 12:04
There's has to be a cleaner way to do this with rspec and ruby
[ ["1,2",3], ["1,3",4] ].each do |arr|
it "'s add method should return the sum of multiple numbers" do
StringCalc.new.add(arr[0]).should == arr[1]
end
end
@royosherove
royosherove / gist:1949777
Created March 1, 2012 13:22
my ohmyzsh theme
#!/usr/bin/env zsh
#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
setopt promptsubst
autoload -U add-zsh-hook
PROMPT_SUCCESS_COLOR=$FG[117]
PROMPT_FAILURE_COLOR=$FG[124]
PROMPT_VCS_INFO_COLOR=$FG[242]
@royosherove
royosherove / gist:2272892
Created April 1, 2012 07:46
Isolator bug with Isolate.nonpublic.wascalled.witharguments
from my tdd class:
[TestFixture, Isolated]
public class LoginManagerWithStaticTestIsolator1
{
[Test]
public void IsLoginOK_LoggerThrowsException_CalledWebService()
{
LoginManagerWithFutureObject lm = new LoginManagerWithFutureObject();
@royosherove
royosherove / gist:2709023
Created May 16, 2012 09:22
Test Driven Validation Logic with Extract & Override
public class Dinner
{
public string Description { get; set; }
public string Title { get; set; }
public DateTime EventDate { get; set; }
public bool IsValid { get { return validate(); }}
private bool validate()
{
@royosherove
royosherove / inheritanceclasses.cs
Created September 11, 2012 05:51
class for testing inheritance
using System.IO;
namespace Demos.Inheritance
{
interface ICustomLogger
{
void Write(LogMessage msg);
void SetTarget(string locationOfFileOrService);
void Enable();
void Disable();
@royosherove
royosherove / gist:3696673
Created September 11, 2012 07:28
Build your own typemock
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TypeMock.Internal.Hooks;
namespace MyInterceptor
{
public class Class1
{
@royosherove
royosherove / string_calculator_spec.rb
Created October 10, 2012 15:29
start of string calculator kata in ruby
require "rspec"
class StringCalculator
def add(numbers)
return 0 if numbers == ""
return numbers.to_i unless numbers.include? ","
return numbers[0].to_i + numbers[2].to_i
end
@royosherove
royosherove / string_calculator_test_unit1.rb
Created October 11, 2012 13:34
simplest string calculator with test_unit and ruby
require "test/unit"
class StringCalculator
NEGATIVES_MSG = "negatives not allowed"
START_OF_CUSTOMDELIM_INDEX = 3
TOO_LARGE = 1001
def add(numbers)