Skip to content

Instantly share code, notes, and snippets.

View andrewmarmion's full-sized avatar

Andrew Marmion andrewmarmion

  • Scotland, UK
  • 09:16 (UTC +01:00)
View GitHub Profile
@andrewmarmion
andrewmarmion / AssertEquals+Diff.swift
Created June 10, 2021 21:01 — forked from mugbug/AssertEquals+Diff.swift
XCTestCase wrapper for asserting equatable structs with formatted error diff message
import XCTest
// Credits: https://github.com/pointfreeco/swift-composable-architecture
//swiftlint:disable empty_string force_cast force_unwrapping unused_closure_parameter function_body_length
class MyCustomTestCase: XCTestCase {
func assertEqual<T: Equatable>(
expected: T,
actual: T
) {
@andrewmarmion
andrewmarmion / dos2unix.sh
Created August 20, 2018 11:27 — forked from jappy/dos2unix.sh
Shell script to convert files with CRLF to LF (Mac/Linux)
#! /bin/sh
for x
do
echo "Converting $x"
tr -d '\015' < "$x" > "tmp.$x"
mv "tmp.$x" "$x"
done
@andrewmarmion
andrewmarmion / SomeFragment.java
Created February 13, 2017 23:22 — forked from joshdholtz/SomeFragment.java
Android Google Maps V2 - MapView in XML
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);
@andrewmarmion
andrewmarmion / ItemClickSupport.java
Created February 5, 2017 21:19 — forked from nesquena/ItemClickSupport.java
Click handling for RecyclerView
/*
Source: http://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/
USAGE:
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
@Override
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
// do it
}
});