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
# Input: 'foo "foo bar" bar foobar' | |
# Output: ["foo", "foo bar", "bar", "foobar"] | |
# Input 'foo "foo bar baz" bar "foobar" "foo bar bar"' | |
# Output: ["foo", "foo bar baz", "bar", "foobar", "foo bar bar"] | |
def parse(txt) | |
end |
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
ActiveRecord::Migrator.migrate "db/migrate" |
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
.ellipsis { | |
text-overflow: ellipsis; | |
/* Required for text-overflow to do anything */ | |
overflow: hidden; | |
/* Impacts on the result */ | |
white-space: nowrap; | |
} |
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
function joinEndWith(arr, separator, last) { | |
const reg = new RegExp(`(.+)${separator}(.+)`) | |
return arr.join(separator).replace(reg, `$1${last}$2`) | |
} |
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
elasticsearch: | |
image: docker.elastic.co/elasticsearch/elasticsearch:6.1.1 | |
environment: | |
- discovery.type=single-node | |
- "ES_JAVA_OPTS=-Xms750m -Xmx750m" | |
mem_limit: 1024m | |
volumes: | |
- elasticsearch:/usr/share/elasticsearch/data |
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
> function validate(isValid) { return isValid || !isValid } | |
undefined | |
> validate(true) | |
true | |
> validate(false) | |
true | |
> validate(undefined) | |
true | |
> validate(null) | |
true |
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
function arrayEquals(actual, expected) { | |
return actual.every(function(element, i) { | |
if (Array.isArray(element)) { | |
return arrayEquals(element, expected[i]); | |
} | |
return element === expected[i]; | |
}) | |
} | |
function flatten (arr) { |
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
static { | |
RxAndroidPlugins rxAndroidPlugins = RxAndroidPlugins.getInstance(); | |
rxAndroidPlugins.reset(); | |
rxAndroidPlugins.registerSchedulersHook(new RxAndroidSchedulersHook() { | |
@Override | |
public Scheduler getMainThreadScheduler() { | |
return Schedulers.immediate(); | |
} | |
}); | |
} |
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
private void shceduleSomething() { | |
final Handler handler = new Handler(); | |
Timer timer = new Timer(); | |
TimerTask doAsynchronousTask = new TimerTask() { | |
@Override | |
public void run() { | |
handler.post(new Runnable() { | |
public void run() { | |
doSomething(); | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
ol, li { | |
margin: 0; | |
padding: 0; | |
} |
NewerOlder