Skip to content

Instantly share code, notes, and snippets.

View jskeet's full-sized avatar
💭
Very happily employed. I do not wish to hear from recruiters.

Jon Skeet jskeet

💭
Very happily employed. I do not wish to hear from recruiters.
View GitHub Profile
using System;
using System.Drawing;
using System.Windows.Forms;
public class Test
{
static void Main()
{
Button button = new Button
{
using System;
using System.Threading.Tasks;
class Test
{
static void Main()
{
Foo().GetAwaiter().GetResult();
}
import java.util.*;
import java.util.stream.*;
public class Test {
public static void main(String[] args) {
Stream<String> stream = Arrays.stream(
new String[]{"short", "quite long", "very long indeed"})
.filter(x -> { System.out.println("Checking " + x); return x.length() < 12; });
Iterator<String> iterator = stream.iterator();
using System;
public enum Product
{
Work = 33,
Travel = 34
}
public class Test
{
using System;
using System.Threading;
using System.Threading.Tasks;
public class Test
{
static void Main()
{
Task task = DelayAndPrintAsync();
Console.WriteLine("Task returned to Main. Sleeping for 10s");
@jskeet
jskeet / gist:d6723413a01bf0dc4a83066a66cc1c16
Created March 14, 2018 07:25
Print out zone intervals for Auckland
using System;
using System.IO;
using System.Text;
using NodaTime;
class Test
{
static void Main()
{
var start = Instant.FromUtc(2013, 1, 1, 0, 0);
using System;
using Newtonsoft.Json;
public class MainModel
{
[JsonProperty(PropertyName = "pageTitle")]
public string PageTitle { get; set; }
[JsonProperty(PropertyName = "helpBtnText")]
public string HelpButtonText { get; set; }
string type = "test";
string data = @"{""fields"":{""project"":{""key"": ""MD""},""summary"":
""Support EXAMPLE"",""description"": ""Testing Support"",""issuetype"":
{""name"": "+ type +" }}}";
string postUrl = "https://aconline.atlassian.net/rest/api/2/issue";
byte[] cred = UTF8Encoding.UTF8.GetBytes("username:password");
HttpClient client = new HttpClient
{
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
HttpClient client = new HttpClient();
Task<string> request = client.GetStringAsync("http://google.pl");
public class Test {
public static void main(String... args) {
String x = "abc";
String y = "def";
String xy = x + y;
String xyInterned = xy.intern();
System.out.println(xyInterned == xy);
// With this line here, the output is true, true