Skip to content

Instantly share code, notes, and snippets.

View joyoyoyoyoyo's full-sized avatar
🏴
supporting my community

Angel Ortega joyoyoyoyoyo

🏴
supporting my community
  • InterMedia Advertising
  • SoCal / Remote / LA / IE
View GitHub Profile
@berngp
berngp / .gitconfig
Created March 30, 2014 05:27
dot.gitconfig
[user]
name = Your Name
email = [email protected]
[color]
ui = true
[core]
excludesfile = ~/.gitignore_global
editor = /usr/local/bin/mvim -f
@jboner
jboner / PersistedGameOfPingPong.scala
Last active March 27, 2019 16:43
A game of ping pong using two Akka Actors, persisted using Event Sourcing through Akka Persistence
package demo
import akka.actor.{Props, ActorSystem}
import akka.persistence.PersistentActor
object PingPong extends App {
case object Ball // The Command
case object BallReceived // The Domain Event, represents a Fact, something that have already happened
class Ping extends PersistentActor {
@jboner
jboner / GameOfPingPong.scala
Last active March 27, 2019 16:43
A game of ping pong using Akka Actors. For a version that is persisted using Event-Sourcing see this gist: https://gist.github.com/jboner/9990435
package demo
import akka.actor.{Actor, Props, ActorSystem}
object PingPong extends App {
case object Ball
class Ping extends Actor {
var counter = 0
@ceteri
ceteri / 01.repl.txt
Last active April 17, 2022 18:46
Intro to Apache Spark: general code examples
$ ./bin/spark-shell
14/04/18 15:23:49 INFO spark.HttpServer: Starting HTTP Server
14/04/18 15:23:49 INFO server.Server: jetty-7.x.y-SNAPSHOT
14/04/18 15:23:49 INFO server.AbstractConnector: Started [email protected]:49861
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 0.9.1
/_/
@chandu-io
chandu-io / FileSizeBench.java
Last active July 25, 2019 04:36
java :: Serialization and Encryption
// Awesome enum example
//http://stackoverflow.com/questions/116574/java-get-file-size-efficiently
import java.io.*;
import java.net.*;
import java.util.*;
public enum FileSizeBench {
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active May 17, 2026 17:30
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

// 1. Write a code snippet that sets a to an array of n random integers between 0
// (inclusive) and n (exclusive).
val a = new Array[Int](10) //> a : Array[Int] = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
for(i <- 0 until a.length) a(i) = scala.util.Random.nextInt(10)
a //> res0: Array[Int] = Array(9, 0, 5, 8, 6, 6, 3, 9, 0, 3)
// 2. Write a loop that swaps adjacent elements of an array of integers. For example,
// Array(1, 2, 3, 4, 5) becomes Array(2, 1, 4, 3, 5).
val a = Array[Int](1,2,3,4,5)
a //> res1: Array[Int] = Array(1, 2, 3, 4, 5)
@staltz
staltz / introrx.md
Last active May 19, 2026 02:25
The introduction to Reactive Programming you've been missing
@ibuenros
ibuenros / SparkUtils.scala
Created June 29, 2014 17:12
Spark productionizing utilities developed by Ooyala, shown in Spark Summit 2014
//==================================================================
// SPARK INSTRUMENTATION
//==================================================================
import com.codahale.metrics.{MetricRegistry, Meter, Gauge}
import org.apache.spark.{SparkEnv, Accumulator}
import org.apache.spark.metrics.source.Source
import org.joda.time.DateTime
import scala.collection.mutable
@eldritchideen
eldritchideen / gist:ef9295ff6c2f6aeca24e
Last active July 20, 2017 04:46
Web scraping in Scala with Jsoup
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import scala.collection.JavaConversions._
System.setProperty("http.proxyHost", "xxx.xxx.xxx")
val doc = Jsoup.connect("http://www.smh.com.au/business/markets/52-week-highs?page=-1").get()
//doc.body()
val elems = doc.select("#content > section > table > tbody > tr > th > a")
val foo = for ( e <- elems) yield e.text