Skip to content

Instantly share code, notes, and snippets.

View cwc's full-sized avatar
🏠
Working from home

Cameron Currie cwc

🏠
Working from home
  • Texas
  • 16:31 (UTC -05:00)
View GitHub Profile
@cwc
cwc / transform.exs
Last active August 12, 2016 23:00
Can't use Stream.transform with a map accumulator?
iex(1)> list = [1,2,3]
[1,2,3]
iex(2)> Stream.transform(list, fn -> %{} end, fn (x, a) -> Map.put(a, x, "#{x}") end, fn (map) -> Map.values(map) end) |> Enum.to_list
** (TryClauseError) no try clause matching: %{1 => "1"}
(elixir) lib/stream.ex:739: Stream.do_transform/8
(elixir) lib/enum.ex:1636: Enum.reduce/3
(elixir) lib/enum.ex:2346: Enum.to_list/1
@cwc
cwc / parse_failure
Created July 28, 2016 07:45
Shouldn't this timestamp parse correctly?
iex(8)> time
"2016-06-27 13:53:45.149637763-0400"
iex(9)> Timex.parse! time, "{ISO:Extended}"
%Inspect.Error{message: "got ArgumentError with message \"argument error\" while inspecting %{__struct__: DateTime, calendar: Calendar.ISO, day: 27, hour: 13, microsecond: {0, 9}, minute: 53, month: 6, second: 45, std_offset: 0, time_zone: \"Etc/GMT+4\", utc_offset: -14400, year: 2016, zone_abbr: \"GMT+4\"}"}
iex(10)>
@cwc
cwc / keybase.md
Created December 18, 2014 00:30
Keybase proof

Keybase proof

I hereby claim:

  • I am cwc on github.
  • I am cwc (https://keybase.io/cwc) on keybase.
  • I have a public key whose fingerprint is 897F 832E 99FD C90E AA29 6302 E3F2 C226 E1B7 4CEC

To claim this, I am signing this object:

@cwc
cwc / build.gradle
Created August 20, 2014 22:15
Gradle skeleton for publishing to Maven Central
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
group = 'io.example'
archivesBaseName = 'example-artifact'
version = '1.0-SNAPSHOT'
ext.pomPackaging = 'jar'
ext.pomName = 'Example artifact'
ext.pomDescription = 'An example artifact'
@cwc
cwc / broken_cp.xml
Created March 22, 2013 19:41
A tale of two classpaths
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="gen">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" output="target/classes" path="target/generated-sources/annotations">
@cwc
cwc / pom.xml
Created March 21, 2013 17:27
POM skeleton for new Maven projects
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId></groupId>
<artifactId></artifactId>
<version>1.0-SNAPSHOT</version>
<!-- Dependencies
<dependencies>
<dependency>