Skip to content

Instantly share code, notes, and snippets.

@davidalpert
davidalpert / rsync_backup.sh
Created October 28, 2021 02:15 — forked from spyesx/rsync_backup.sh
Rsync backup excluding node_modules
# Backup files
#https://explainshell.com/explain?cmd=rsync+-azuv+--delete+--progress+--exclude+%27node_modules%27
rsync -auvhp --delete --exclude=node_modules [source] [destination]
# Remove all node_modules folders
# https://explainshell.com/explain?cmd=find+.+-name+%22node_modules%22+-type+d+-prune+-exec+rm+-rf+%27%7B%7D%27+%2B
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
public class RedirectedConsole : IDisposable
{
readonly TextWriter outBefore;
readonly TextWriter errBefore;
readonly StringWriter console;
public RedirectedConsole()
{
console = new StringWriter();
outBefore = Console.Out;

Ubuntu 12.04 Ruby on Rails Development Environment

I haven't set up an install guide for the latest ubuntu release, largely because the last set of instructions worked pretty closely with the latest and greatest Ubuntu, 12.04 Precise Pangolin, however when installing today, I found that there were enough differences in the way that I configure my setup to justify an update, so here it goes. Yes, I'm late to the party, but a quick google search didn't find anything that I felt was as complete for my requirements as my previous install guides, so here I go.

As always with my install guides, I have included here is just about everything you'll need (and then some) to get started with ruby on rails development with Ubuntu 12.04 as a platform. These are my settings and preferences, and this is certainly not the only way of doing things, so keep that in mind.

Step 1: Get the repos ready and run updates.

sudo apt-get update && sudo apt-get upgrade
@davidalpert
davidalpert / vimrc
Created November 2, 2012 03:02 — forked from seenmyfate/vimrc
vimrc
" http://mislav.uniqpath.com/2011/12/vim-revisited/
set nocompatible " choose no compatibility with legacy vi
syntax enable
set encoding=utf-8
set showcmd " display incomplete commands
filetype plugin indent on " load file type plugins + indentation
"" Whitespace
set nowrap " don't wrap lines
@davidalpert
davidalpert / gist:2022220
Created March 12, 2012 14:19 — forked from bradwilson/InlineTask.targets.xml
Inline MSBuild task to download NuGet.exe
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
@davidalpert
davidalpert / RecursiveReplace.ps
Created December 29, 2011 13:50 — forked from jongalloway/RecursiveReplace.ps
Recursive replace in files (PowerShell)
$find = 'jquery-1\.4\.4'
$replace = 'jquery-1\.5\.1'
$match = '*.cshtml' , '*.vbhtml'
$preview = $true
foreach ($sc in dir -recurse -include $match | where { test-path $_.fullname -pathtype leaf} ) {
select-string -path $sc -pattern $find
if (!$preview) {
(get-content $sc) | foreach-object { $_ -replace $find, $replace } | set-content $sc
}
@davidalpert
davidalpert / gist:1079718
Created July 13, 2011 04:26 — forked from thecodejunkie/gist:898770
Blog - Hello World
public class MainModule : NancyModule
{
public MainModule()
{
Get["/"] = parameters => {
return "Hello World";
};
}
}
@davidalpert
davidalpert / dep.cs
Created July 4, 2011 21:57 — forked from gregoryyoung/dep.cs
depositor specification
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Simple.Testing.Framework;
namespace Simple.Testing.Example
{
/*
@davidalpert
davidalpert / Rakefile.rb
Created May 7, 2011 16:27 — forked from amirci/Rakefile.rb
Rakefile to generate nuget packages passing the name of the package, version and folder to get the assemblies from
require 'rubygems'
require 'rake/clean'
require 'albacore'
include FileUtils
desc 'Publish nuget package'
task :default => ["deploy:publish"]
namespace :deploy do
(function($)
{
$.fn.myPlugin = function(optionsOrCommand, commandOptions)
{
if (optionsOrCommand == 'someCommand')
{
return this.each(function()
{
this.myPlugin.someOtherFunction();
});