This file contains hidden or 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
georginaumov@virtualbox:~/Documents$ php -a | |
Interactive mode enabled | |
php > ['first' => $first, 'second' => $second] = ['first' => 'Tom', 'second' => 'Jerry']; | |
php > var_dump([$first, $second]); | |
array(2) { | |
[0]=> | |
string(3) "Tom" | |
[1]=> | |
string(5) "Jerry" |
This file contains hidden or 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
fun getGreeting(): String = "Hello Kotlin" |
This file contains hidden or 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
/** | |
* In this example, `val` denotes a declaration of a read-only local variable, | |
* that is assigned an pattern matching expression. | |
* See http://kotlinlang.org/docs/reference/control-flow.html#when-expression | |
*/ | |
fun main(args: Array<String>) { | |
val language = if (args.size == 0) "EN" else args[0] | |
println(when (language) { | |
"EN" -> "Hello!" |
This file contains hidden or 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
const getLastImport = (input) => { | |
const [,lastImport] = /(import\s+\w+)(?:(?!import\s+\w+).)*$/.exec(input) || [,false]; | |
return lastImport; | |
} |
This file contains hidden or 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
/** | |
* You can edit, run, and share this code. | |
* play.kotlinlang.org | |
*/ | |
data class MyResponse( | |
val bigger: Int, | |
val lower: Int | |
) | |
fun main() { |
This file contains hidden or 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
// here never.created is Data | |
// formatter is SimpleDateFormat("y-M-d H:m:s") | |
// with timeZone = TimeZone.getTimeZone("UTC") | |
// The problem is that this comparison | |
// working properly on UTC+0 | |
// When I set timeZone = TimeZone.getDefault() | |
// it starts to work on every other timezone | |
// instead UTC. The question is how to fix | |
// that in shortest way? Maybe to calculate | |
// current timezone offset and just to |
This file contains hidden or 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
val calculatedTimezoneOffset = TimeZone.getDefault().let { | |
// The problem is | |
// TimeZone.getTimeZone("UK").inDaylightTime(Date()) | |
// is false every time. If this is true everything pass. | |
val offset = if(TimeZone.getTimeZone("UK").inDaylightTime(Date())) | |
it.getOffset(System.currentTimeMillis()) + 3600000 // -> this is the one hour of daily saving time. | |
else | |
it.getOffset(System.currentTimeMillis()) | |
offset | |
} |
This file contains hidden or 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
/** | |
* Мисля, че това, което искаш да постигнеш е това: | |
***/ | |
console.log(/^[\u0410-\u044FA-Z0-9\\'\\/@#\\.\\*:]+$/i.test("test1")); | |
// true | |
console.log(/^[\u0410-\u044FA-Z0-9\\'\\/@#\\.\\*:]+$/i.test("кирилица1")); | |
// true | |
console.log(/^[\u0410-\u044FA-Z0-9\\'\\/@#\\.\\*:]+$/i.test("111111")); | |
// true | |
/** |
This file contains hidden or 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() { | |
var css = ["* {", | |
"-webkit-touch-callout: default !important;", | |
"-webkit-user-select: auto !important;", | |
"-khtml-user-select: auto !important;", | |
"-moz-user-select: auto !important;", | |
"-ms-user-select: auto !important;", | |
"user-select: auto !important;", | |
"cursor: auto !important;", | |
"-webkit-tap-highlight-color: black !important;", |
This file contains hidden or 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
<!-- | |
Just an idea. You don't need any event listeners, | |
id's and etc. Try this. If it works for you this | |
is the cleanest solution. | |
--> | |
<div style="display: none;"> | |
[ | |
{"id": 1}, | |
{"id": 2} | |
] |