This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package util | |
object Slug { | |
def apply(input:String) = slugify(input) | |
def slugify(input: String): String = { | |
import java.text.Normalizer | |
Normalizer.normalize(input, Normalizer.Form.NFD) | |
.replaceAll("[^\\w\\s-]", "") // Remove all non-word, non-space or non-dash characters | |
.replace('-', ' ') // Replace dashes with spaces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The contents of this file are subject to the Mozilla Public License | |
// Version 1.1 (the "License"); you may not use this file except in | |
// compliance with the License. You may obtain a copy of the License at | |
// http://www.mozilla.org/MPL/ | |
// | |
// Software distributed under the License is distributed on an "AS IS" | |
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
// License for the specific language governing rights and limitations | |
// under the License. | |
// |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
- Stores data elements based on an sequential, most commonly 0 based, index.
- Based on tuples from set theory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html | |
# See https://docs.oracle.com/javase/8/docs/technotes/guides/vm/performance-enhancements-7.html | |
# See https://docs.oracle.com/javase/8/embedded/develop-apps-platforms/codecache.htm | |
# See http://normanmaurer.me/blog_in_progress/2013/11/07/Inline-all-the-Things/ | |
# See http://stas-blogspot.blogspot.com.br/2011/07/most-complete-list-of-xx-options-for.html | |
# -XX:+LogCompilation | |
# -XX:+PrintInlining | |
-Dfile.encoding=UTF-8 |
#System Design Interview Cheatsheet
Picking the right architecture = Picking the right battles + Managing trade-offs
##Basic Steps
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
sudo apt-get update | |
sudo apt-get -y install linux-image-extra-$(uname -r) apt-transport-https ca-certificates | |
# Add Docker PPA and install latest version | |
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS `country` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`iso` char(2) NOT NULL, | |
`name` varchar(80) NOT NULL, | |
`nicename` varchar(80) NOT NULL, | |
`iso3` char(3) DEFAULT NULL, | |
`numcode` smallint(6) DEFAULT NULL, | |
`phonecode` int(5) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{:city=>"Ada", :region=>"OK", :dma_code=>657}, | |
{:city=>"Akron", :region=>"OH", :dma_code=>510}, | |
{:city=>"Albany", :region=>"GA", :dma_code=>525}, | |
{:city=>"Alexandria", :region=>"LA", :dma_code=>644}, | |
{:city=>"Alpena", :region=>"MI", :dma_code=>583}, | |
{:city=>"Altoona", :region=>"PA", :dma_code=>574}, | |
{:city=>"Amarillo", :region=>"TX", :dma_code=>634}, | |
{:city=>"Ames", :region=>"IA", :dma_code=>679}, | |
{:city=>"Anchorage", :region=>"AK", :dma_code=>743}, | |
{:city=>"Anderson", :region=>"SC", :dma_code=>567}, |
Kafka acts as a kind of write-ahead log (WAL) that records messages to a persistent store (disk) and allows subscribers to read and apply these changes to their own stores in a system appropriate time-frame.
Terminology:
- Producers send messages to brokers
- Consumers read messages from brokers
- Messages are sent to a topic
NewerOlder