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
/* | |
Observation: To find all substrings of s we have i = 0 til s.length and j = i+1 till s.length and we append each substring s[i:j] to the results. | |
We need to also have a map to check for duplicates. | |
*/ | |
func Substrings(s string) []string { | |
result := []string{} | |
seen := make(map[string]interface{}) | |
for i := 0;i < len(s); i += 1 { | |
for j := i+1; j <= len(s); j += 1 { |
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
/** | |
* Flattens an array of arbitrarily nested arrays of integers | |
* into a flat array of integers. | |
* | |
* @param {array} arr The array to flatten. | |
* @returns {array} Flattened array | |
*/ | |
const flatten = (arr = []) => { | |
if (!isArray(arr)) { | |
return []; |
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
{ "name":"John", "age":30, "phone":null } |
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
Εσύ και 9 άλλοι το αγαπάτε |
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 loadCldrData(languageTag = 'en', $ = jQuery) { | |
return $.when( | |
$.get( `js/vendor/cldr/${languageTag}/ca-gregorian.json` ), | |
$.get( `js/vendor/cldr/${languageTag}/currencies.json` ), | |
$.get( `js/vendor/cldr/${languageTag}/numbers.json`), | |
$.get( `js/vendor/cldr/${languageTag}/units.json` ), | |
).then(function() { | |
// Normalize $.get results, we only need the JSON, not the request statuses. | |
return [].slice.apply( arguments, [ 0 ] ).map(function( result ) { | |
return result[ 0 ]; |
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($) { | |
$.when( | |
$.get( 'js/vendor/cldr/en/ca-gregorian.json' ), | |
$.get( 'js/vendor/cldr/en/currencies.json' ), | |
$.get( 'js/vendor/cldr/en/numbers.json' ), | |
$.get( 'js/vendor/cldr/en/units.json' ), | |
$.get( 'js/vendor/cldr/supplemental/plurals.json' ), | |
$.get( 'js/vendor/cldr/supplemental/timeData.json' ), | |
$.get( 'js/vendor/cldr/supplemental/weekData.json' ), | |
$.get( 'js/vendor/cldr/supplemental/likelySubtags.json' ) |
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
{ | |
"el": { | |
"like": [ | |
"{0, plural, offset:1", | |
" =0 {Αγάπησε το}", | |
" =1 {Το αγαπάς ήδη}", | |
" one {Εσύ και καποιος άλλος το αγαπάτε}", | |
" other {Εσύ και # άλλοι το αγαπάτε}", | |
"}" | |
] |
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
➜ tree src/locale | |
src/locale | |
├── el | |
│ └── messages.json | |
└── en | |
└── messages.json | |
2 directories, 2 files |
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
Detected user locale is en | |
main.js:21 Locale Changed to el | |
main.js:36 Current user locale is el |