This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_slicing_arrays_is_weird | |
array = [:peanut, :butter, :and, :jelly] | |
assert_equal :peanut, array[0] | |
assert_equal :butter, array[1] | |
assert_equal :and, array[2] | |
assert_equal :jelly, array[3] | |
# this confirms that 4 is an invalid index into the array | |
assert_equal nil, array[4] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_old_style_here_doc | |
here_doc_style = <<WHEE | |
foo | |
bar | |
WHEE | |
flexible_quote_style = %{ | |
foo | |
bar | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [master] | |
GO | |
CREATE DATABASE [testing] | |
GO | |
USE [testing] | |
GO | |
CREATE TABLE [dbo].[Items]( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net.Sockets; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication2 | |
{ | |
class Program |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var instances = new AbstractBase[] | |
{ | |
new RegularTaskApproach(), | |
new AsyncAwaitApproach(), | |
new RegularTaskDerivedFromAsyncAwaitApproach(), | |
new RegularTaskUsingBaseAsyncAwaitApproach(), | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var webClient = new WebClient(); | |
var requestParameters = new NameValueCollection() | |
{ | |
{ "url", "http://www.hondaelcerritonews.com/news/2012/MayNewsletter/?view=Email" }, | |
{ "preserve_styles", "false" }, | |
{ "remove_ids", "true" }, | |
{ "remove_classes", "true" }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get reference to the running iTunes | |
$itunes = New-Object -ComObject iTunes.application | |
# get all tracks in the entire library | |
$allTracks = $itunes.LibraryPlaylist.Tracks | |
# find the entries that are no longer on disk | |
# NOTE: the API returns the location as null for those, so we check for | |
# that instead of doing our own filtering based on test-path or similar | |
$deadEntries = $allTracks | ?{ $_.Location -eq $null } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET NOCOUNT ON | |
GO | |
PRINT 'Using Master database' | |
USE master | |
GO | |
PRINT 'Checking for the existence of this procedure' | |
IF (SELECT OBJECT_ID('sp_generate_inserts','P')) IS NOT NULL --means, the procedure already exists | |
BEGIN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var databaseInfo = GetDatabaseInfo(this); | |
databaseInfo.Dump(); | |
} | |
// Define other methods and classes here | |
public class DatabaseInfo | |
{ | |
public Type DataContextType { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var databaseInfo = GetDatabaseInfo(this); | |
// databaseInfo.Dump(); | |
foreach (var table in databaseInfo.Tables) | |
{ | |
var nullableColumns = | |
from c in table.Columns | |
where c.DatabaseType.EndsWith(" NOT NULL") == false |