Skip to content

Instantly share code, notes, and snippets.

View Pegolon's full-sized avatar

Markus Kirschner Pegolon

View GitHub Profile
@Pegolon
Pegolon / Main.purs
Last active October 31, 2022 19:51
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (log)
import TryPureScript (render, withConsole)
main :: Effect Unit
main = render =<< withConsole do
log "Hello, world!"
@Pegolon
Pegolon / Directory.Build.props
Created August 13, 2020 10:29
Use C# projects at the same time on Windows and Mac (and even Linux)
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Choose>
<When Condition="'$(OS)' == 'Windows_NT'">
<PropertyGroup>
<BaseIntermediateOutputPath>B:/$(MSBuildProjectFile) Intermediate/</BaseIntermediateOutputPath>
<OutputPath>B:/$(MSBuildProjectFile) Output/$(Configuration)/</OutputPath>
</PropertyGroup>
</When>
<Otherwise>
@Pegolon
Pegolon / launch.json
Created April 4, 2019 13:16
Debug Rake with Visual Studio Code
{
"version": "0.2.0",
"configurations": [
{
"name": "Rake",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "/usr/bin/rake",
"env": {
@Pegolon
Pegolon / xml_to_yaml.rb
Last active March 29, 2019 12:52
Convert XML to YAML
require 'active_support/core_ext/hash/conversions'
require 'yaml'
source_file_path='/path/to/file.xml'
target_file_path='/path/to/file.yaml'
File.write(target_file_path, Hash.from_xml(File.read(source_file_path)).to_yaml)
@Pegolon
Pegolon / testing.m
Last active September 27, 2018 13:10
#pragma mark - Simple Unit Test
- (void)test_callSomeoneWith_giveSomething_getSomething {
MyClass *sut = [MyClass new];
NSString *input = @„give something“;
NSString *expectedResult = @„get something“;
NSString *result = [sut callSomeoneWith:input];
XCTAssertEqualObjects(result, expectedResult);
}
#!/usr/bin/env ruby
# This will compile the given Swift script and run it
unless ARGV.count == 1
puts "Please provide the path for the Swift source file to compile and run"
exit -1
end
SOURCE_FILE = ARGV[0]
BASE_NAME = File.basename(SOURCE_FILE, ".swift")
@Pegolon
Pegolon / debug.swift
Created June 21, 2018 15:53
Cast pointer to Swift object (eg. print out current URL for webView from view debugger)
expr -l Swift -- import UIKit
expr -l Swift -- let $webview = unsafeBitCast(0x7b500026ca00, to: UIWebView.self)
expr -l Swift -- print($webview.request.url)
@Pegolon
Pegolon / count_loc.sh
Created April 19, 2018 08:24
Count lines of code in Swift files
# brew install cloc
cloc --csv --csv-delimiter=";" --report-file=~/Desktop/output.csv .
var simulateScrollingTimer: Timer?
var scrollUp = false
private func simulateScrolling() {
collectionView.contentOffset = CGPoint.zero
scrollUp = false
simulateScrollingTimer = Timer.scheduledTimer(timeInterval: 0.5, target: self, selector: #selector(simulateSwipe), userInfo: nil, repeats: true)
}
private func simulateSwipe() {
guard collectionView.contentSize.height > 0
class MyClass {}
let anObject = MyClass()
print("The address of anObject is \(ObjectIdentifier(anObject))")