Skip to content

Instantly share code, notes, and snippets.

View washingtonsoares's full-sized avatar
🎯
Focusing

Washington Soares washingtonsoares

🎯
Focusing
View GitHub Profile
@washingtonsoares
washingtonsoares / array_iteration_thoughts.md
Created January 13, 2017 14:58 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

@washingtonsoares
washingtonsoares / spark.md
Created December 14, 2016 19:20 — forked from jesperfj/spark.md
Spark on Heroku

This guide will get you started using Spark on Heroku/Cedar. Spark is basically a clone of Sinatra for Java. 'Nuff said.

Create your app

Create a single Java main class in src/main/java/HelloWorld.java:

:::java
import static spark.Spark.*;
import spark.*;
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java -Djava.library.path=/Users/Washington/projects/tcc/libs-vp/jlfgr-1_0.jar "-Djava.library.path=/Users/Washington/projects/tcc/libs\ VCS" -Didea.launcher.port=7533 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jr
@washingtonsoares
washingtonsoares / git-zsh-checkout-autocomplete-local-only.md
Created October 15, 2016 22:17 — forked from mmrko/git-zsh-checkout-autocomplete-local-only.md
List only local branches when autocompleting git checkout (Zsh)
git config --global alias.checkoutr checkout
nano /usr/local/share/zsh/site-functions/git-completion.bash

...and then modify the file as follows...

-__gitcomp_nl "$(__git_refs '' $track)"
+if [ "$command" = "checkoutr" ]; then
+    __gitcomp_nl "$(__git_refs '' $track)"
+else
package javaapplication1;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Collections.sort(savedClientSectors, new Comparator<ClientSector>() {
@Override
public int compare(ClientSector o1, ClientSector o2) {
return o1.getName().compareTo(o2.getName());
}
});
'use strict';
angular.module('multiVideo',[])
.directive('multiVideo', function ($compile,$sce,$rootScope,$interval,$window) {
var templateWrapperProgressBar = '<div class="progress-wrapper">'+
'<div class="progress-overlay"></div>'+
'</div>';
var templateProgressBar = '<div class="progress-play" ></div>'+
window.addEventListener('online', networkStatus);
window.addEventListener('offline', networkStatus);
function networkStatus(e){
console.log(e.type);
}
package p_1161;
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String args[]) throws IOException {
Scanner sc = new Scanner(System.in);
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
ArrayList<String> palavras = new ArrayList<>();
int qtd = sc.nextInt();