1 2 3 4 5 6 7 8 9 10 11 12 13 |
function get_client_language($availableLanguages, $default='en'){ if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $langs=explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']); foreach ($langs as $value){ $choice=substr($value,0,2); if(in_array($choice, $availableLanguages)){ return $choice; } } } return $default; } |
Dragdealer.js is a drag-based JavaScript component, embracing endless UI solutions.
The lib provides a huge amount of options to use it for a multitude of functions.
This is a simple loop to check for a partial key in an Array
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
/** * Extend the Array object * @param searchValue is the string to search for * @returns Returns all matches */ Array.prototype.searchFor = function(searchValue) { var pattern = new RegExp('^'+searchValue+''); var matches = []; for (var key in this) { if (pattern.test(key)) { matches.push(key); } } return matches; }; |
Use it like this
1 2 3 |
var searchValue = "checkForMe"; var searchArray = []; var matches = searchArray.searchFor(searchValue); |
I am using something similar to look though a huge word/key index and output matching keys that link to a Data object.
I wish you all
I am taking a litte break and will be back to work next week.
Enjoy your time with family and friends
GistBox is a shared code library that allows you to manage Github gists with your team. All neatly packaged into a Chrome App.
„Gisto is a code snippet manager that runs on GitHub Gists and adds additional features such as searching, tagging and sharing gists while including a rich code editor. All your data is stored on GitHub and you can access it from GitHub Gists at any time with changes carrying over to Gisto.“
The application is multi-platform.
„Mosaico is a JavaScript library (or maybe a single page application) supporting the editing of email templates.
The great thing is that Mosaico itself does not define what you can edit or what styles you can change: this is defined by the template.
This makes Mosaico very flexible.“
Nested is a jQuery plugin which allows you to create multi-column and dynamic grid layouts. All completely gap-free.