Skip to content

Instantly share code, notes, and snippets.

View cr0wst's full-sized avatar

Steve Crow cr0wst

View GitHub Profile
@cr0wst
cr0wst / MultiplyAllByFive.java
Last active June 17, 2018 15:06
Java Stream Example: Multiple all elements by 5
package net.smcrow.sandbox.streams;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class MultiplyAllByFive {
private static final List<Integer> NUMBERS = List.of(1, 2, 3, 4, 5);
@cr0wst
cr0wst / AllExceptCurrent.java
Created June 17, 2018 14:33
Java Stream Example: Iterate through list and display all others for each element.
package net.smcrow.sandbox.streams;
import java.util.List;
public class AllExceptCurrent {
private static final List<String> FRIENDS = List.of("Sarah", "John", "Megan", "Joseph");
public static void main(String... args) {
System.out.println("Without Streams");
withoutStreams();
@cr0wst
cr0wst / Person.php
Created February 24, 2018 19:44
Example of Person w/ Builder.
<?php
class Person {
protected $firstName;
protected $middleName;
protected $lastName;
protected $age;
protected $gender;
protected $height;
@cr0wst
cr0wst / Sample.php
Created February 23, 2018 16:49
Inner Builder Example
<?php
namespace Smcrow\Sample;
class Sample
{
protected $id;
protected $comments;
public static function builder()
@cr0wst
cr0wst / MessageStatus.java
Created January 21, 2018 01:04
Nexmo SMS XML -> JSON
package com.nexmo.client.sms;
import java.util.HashMap;
import java.util.Map;
public enum MessageStatus {
STATUS_OK(0),
STATUS_THROTTLED(1),
STATUS_MISSING_PARAMS(2),
STATUS_INVALID_PARAMS(3),