Skip to content

Instantly share code, notes, and snippets.

View javajosh's full-sized avatar

javajosh javajosh

View GitHub Profile
@javajosh
javajosh / third.erl
Created February 25, 2017 07:00
An exercise for the Future Learn Erlang course.
%%%-------------------------------------------------------------------
%%% @author josh
%%% @copyright (C) 2017, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 24. Feb 2017 10:36 PM
%%%-------------------------------------------------------------------
-module(third).
-author("josh").

Keybase proof

I hereby claim:

  • I am javajosh on github.
  • I am javajosh (https://keybase.io/javajosh) on keybase.
  • I have a public key ASBWfT1j9sHejkah-3Hw6gk_6Rl-fnnLzO9WqiEEj-FzDQo

To claim this, I am signing this object:

@javajosh
javajosh / redemption.js
Created May 28, 2015 23:03
A fancy deletion
function makeList(n){
var head = {'i':0};
var prev = head;
var current;
for (var i = 1; i < n; i++) {
current = {'i': i};
prev.next = current;
prev = current;
};
@javajosh
javajosh / Foo.class
Last active August 29, 2015 14:21
Java Lambdas and The Case of the Missing imul
//javap -c -p Foo.class
Compiled from "Foo.java"
class Foo {
Foo();
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String[]);
@javajosh
javajosh / Lamda1
Last active August 29, 2015 14:21
final List<Integer> numbers = Arrays.asList(1,2,3,4,5,6,6);
Set<Integer> unique = numbers
.stream()
.map(x -> x * x)
.filter(x -> x < 10)
.collect(Collectors.toSet());
@javajosh
javajosh / gist:3c83cd66922ef27a0431
Created February 2, 2015 18:30
How to Tab out of a closed quote in Sublime text
{ "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "following_text", "operator": "regex_contains", "operand": "^[)'\"\\]]", "match_all": true },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
]
}
[{"name": "foo"},{"name": "bar"}]
<snippet>
<content><![CDATA[
blah blah
]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>html5</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.html</scope>
<!-- Optional: Description to show in the menu -->
<description>My Fancy HTML snippet</description>
apply plugin: 'groovy'
apply plugin: 'idea'
repositories {
mavenCentral()
}
configurations {
provided
testCompile.extendsFrom provided
@javajosh
javajosh / Maps2Objects.groovy
Created June 18, 2013 17:37
Doing groovy stuff
//Groovy has some nice features that make constructing new objects from maps.
//This file explores some of the ways we can get to collections, and nested collections of correctly typed objects.
class Player{
String name
int seat
}
Player alice = [name: "alice", seat: 3] as Player
assert (alice instanceof Player)