Like PHP's htmlentities()/htmlspecialchars() functions, JavaScript is easy to implement it.
/**| <?php | |
| /* | |
| string vtt_to_srt(string $in) | |
| */ | |
| function vtt_to_srt($in) { | |
| $in = preg_split('@(\r\n|\n)+@', trim($in)); | |
| $n = 1; | |
| $out = ''; | |
| for ($i = 1; $i < count($in); $i += 2) { | |
| $out .= $n++ . "\n"; |
Like PHP's htmlentities()/htmlspecialchars() functions, JavaScript is easy to implement it.
/**| function slugify(string) { | |
| const a = 'àáäâãåăæąçćčđďèéěėëêęğǵḧìíïîįłḿǹńňñòóöôœøṕŕřßşśšșťțùúüûǘůűūųẃẍÿýźžż·/_,:;' | |
| const b = 'aaaaaaaaacccddeeeeeeegghiiiiilmnnnnooooooprrsssssttuuuuuuuuuwxyyzzz------' | |
| const p = new RegExp(a.split('').join('|'), 'g') | |
| return string.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters | |
| .replace(/&/g, '-and-') // Replace & with 'and' | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word characters |
| // create the function | |
| DB::connection()->pdo->sqliteCreateFunction("REGEXP", "preg_match", 2); | |
| // build a query | |
| DB::table('tablename')->raw_where('REGEXP("#^[a-z]+$#iu", tablename.row)')->get(); |
| import 'whatwg-fetch' | |
| import Auth from './Auth'; | |
| import Url from 'url-parse'; | |
| const API_URL = process.env.API_URL | |
| const http = { | |
| get: get, | |
| getAuthed: getAuthed, |
| <?php | |
| $rss = new SimpleXMLElement('<rss version="2.0"/>'); | |
| $channel = $rss->addChild('channel'); | |
| $item = $channel->addChild('item'); | |
| $item->addChild('title')->{0} = 'Convicts flood streets of Boston'; | |
| $item->addChild('link')->{0} = 'http://www.example.com/2012/04/convicts-flood-streets-of-boston/'; | |
| $item->addChild('description')->{0} = 'Summarize news story here.'; |
| <form action="" enctype="multipart/form-data" method="post"> | |
| <input id="file" name="file" type="file" /> | |
| <input id="Submit" name="submit" type="submit" value="Submit" /> | |
| </form> |
| --- | |
| METHOD 1 | |
| This should roughly sort the items on distance in MySQL, and should work in SQLite. | |
| If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance. | |
| --- | |
| SELECT * | |
| FROM table | |
| ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC |
| public function helpFilter() | |
| { | |
| /* | |
| Kullanımı: | |
| Tema içerisinde : | |
| $helpFilter->helpFilter(); | |
| $helpFilter = $this->helper('Kafkaca\CustomWidget\Helper\Data'); | |
| Modul İçinde: |
| sailthru | New York, NY | sailthru/sailthru-magento-extension | 2011-06-30 19:01:37 +0000 UTC | |
|---|---|---|---|---|
| yireo | Netherlands | yireo/plg_magentoapi | 2012-08-09 07:54:21 +0000 UTC | |
| mferracioli | São José do Rio Preto | mferracioli/magento-pagseguro | 2011-10-20 17:24:14 +0000 UTC | |
| Vinai | Germany | Vinai/customer-activation | 2012-07-20 06:21:41 +0000 UTC | |
| jacquesbh | Paris | jacquesbh/jbh_connectas | 2012-07-19 06:45:41 +0000 UTC | |
| magento | not found | magento/magento2 | 2011-11-30 15:30:13 +0000 UTC | |
| mollie | Amsterdam, Netherlands | mollie/Magento | 2012-01-24 14:35:15 +0000 UTC | |
| sheerid | not found | sheerid/sheerid-magento | 2012-05-02 15:23:51 +0000 UTC | |
| netz98 | Mainz | netz98/n98-magerun | 2012-08-01 13:13:14 +0000 UTC | |
| PayU | Grunwaldzka 182, 60-166 Poznań | PayU/plugin_magento | 2012-05-16 20:04:10 +0000 UTC |