Resources: Implementing a Dispose Method IDisposable Interface
To use, drop dispose.snippet into:
C:\Users\[YOU]\Documents\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets
Copyright (c) 2011 Jim Schubert | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
#!/usr/bin/env perl | |
# This script filters an apache log by HTTP code and outputs in a slightly more readable fashion. | |
my $usage = <<"USAGE"; | |
usage: $0 logfile status_code | |
For example: | |
$0 apache.log 302 | |
$0 apache.log | |
Notes: | |
Status 200 is shown by default | |
USAGE |
<?xml version="1.0" encoding="utf-8" ?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>propv</Title> | |
<Shortcut>propv</Shortcut> | |
<Description>Code snippet for an automatically implemented virtual property | |
Language Version: C# 3.0 or higher</Description> | |
<Author>James Schubert</Author> | |
<SnippetTypes> |
JS = $(shell find public/javascripts -type f \( -iname "*.js" ! -name "*.min.js" \) ) | |
MINIFY = $(JS:.js=.min.js) | |
all: clean $(MINIFY) | |
clean: | |
rm -f $(MINIFY) | |
%.min.js: %.js | |
node ./node_modules/uglify-js/bin/uglifyjs -o $@ $< |
/* | |
The MIT License | |
Copyright (c) 2011 Jim Schubert | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
/// | |
/// Sample library for using IFilter to read text from any registered filter type. | |
/// | |
/// Helpful links: | |
/// http://msdn.microsoft.com/en-us/library/ms691105(VS.85).aspx | |
/// http://ifilter.codeplex.com/ | |
/// http://www.pinvoke.net/default.aspx/query/LoadIFilter.html | |
/// | |
/// Code here is taken from a combination of the project located at http://ifilter.codeplex.com/ | |
/// as well as definitions taken from p-invoke.net. License is MS-PL so enjoy. |
Resources: Implementing a Dispose Method IDisposable Interface
To use, drop dispose.snippet into:
C:\Users\[YOU]\Documents\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets
#!/usr/bin/env perl | |
# words.pl: Find all possible slogan words from a single sentence. | |
use strict; $|++; | |
@ARGV >= 2 or die "usage: $0 input_file output_file 'sentence'\n"; | |
my ($infile, $outfile, $sentence) = @ARGV; | |
$sentence = $sentence || 'how much wood could a woodchuck chuck'; | |
open INPUT, "< $infile" or die $!; | |
open OUTPUT, "> $outfile" or die $!; |
Some code for a question on StackOverflow. see here.
Inputs taken from the list of Linux Kernel Contributors.
Output lines are numbered. Remove the i,
from the print line to remove the numbers.
Public Class Application | |
Public Shared Sub Main() | |
System.Console.WriteLine("Trying out CInt") | |
Try | |
' CInt Float | |
Dim FLOAT_VAL As Single = 99.09 | |
Dim i As Integer = CInt(FLOAT_VAL) |