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
{ | |
"facts": [ | |
"Unlike dogs, cats do not have a sweet tooth. Scientists believe this is due to a mutation in a key taste receptor.", | |
"When a cat chases its prey, it keeps its head level. Dogs and humans bob their heads up and down.", | |
"The technical term for a cat’s hairball is a “bezoar.”", | |
"A group of cats is called a “clowder.”", | |
"A cat can’t climb head first down a tree because every claw on a cat’s paw points the same way. To get down from a tree, a cat must back down.", | |
"Cats make about 100 different sounds. Dogs make only about 10.", | |
"There are more than 500 million domestic cats in the world, with approximately 40 recognized breeds.", | |
"While it is commonly thought that the ancient Egyptians were the first to domesticate cats, the oldest known pet cat was recently found in a 9,500-year-old grave on the Mediterranean island of Cyprus. This grave predates early Egyptian art depicting cats by 4,000 years or more.", |
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
# Read the input from the file | |
with open("input.txt") as f: | |
rucksacks = f.readlines() | |
# Initialize the sum of priorities to 0 | |
sum_of_priorities = 0 | |
# Loop over each rucksack | |
for rucksack in rucksacks: | |
# Split the rucksack into two compartments |
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
import Foundation | |
import ShellOut | |
do { | |
try shellOut(to: "SwitchAudioSource -a") | |
} catch { | |
print("Couldn't find SwitchAudioSource.") | |
print("Please install switchaudio-osx via homebrew.") | |
exit(1) | |
} |
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
import SwiftUI | |
struct MapView: UIViewRepresentable { | |
var coordinate: CLLocationCoordinate2D | |
func makeUIView(context: Context) -> MKMapView { | |
MKMapView(frame: .zero) | |
} | |
func updateUIView(_ view: MKMapView, context: Context) { |
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
#!/usr/bin/env python | |
import csv | |
import re | |
import datetime | |
from time import mktime | |
from tweepy import OAuthHandler | |
from tweepy import API |
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
#!/bin/sh | |
# Supported desktop environments | |
# 1. Aqua (MacOS) | |
# 2. Gnome | |
# 3. Unity | |
# 4. Feh | |
# 5. xfce4 | |
# 6. KDE |
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
enum TestErr { | |
MuchFatalSuchWow, | |
} | |
fn return_result() -> Result<String, TestErr> { | |
// String::new() // doesn't work | |
// TestErr::MuchFatalSuchWow // doesn't work | |
Err(TestErr::MuchFatalSuchWow) | |
} |
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
POST http://webapi.vvo-online.de/dm?format=json | |
Accept: application/json, text/plain, */* | |
{ | |
"stopid": "33000037", | |
"time": "2016-11-13T16:01:12Z", | |
"isarrival": false, | |
"limit": 30, | |
"shorttermchanges": 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
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"html" | |
"io/ioutil" | |
"net/http" | |
"os" |
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
#import <Foundation/Foundation.h> | |
@interface Person : NSObject | |
{ | |
@private char *name; | |
} | |
@property (readwrite, assign) char *name; | |
- (void)sayHello; | |
@end |
NewerOlder