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
| cat db/seeds/countries.json | ruby -rubygems -e 'require "json";a=JSON.pretty_generate JSON.parse gets;File.open("db/seeds/countries.json", "w"){|f| f << a}' |
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
| country_list = [ | |
| [ "Germany", 81831000 ], | |
| [ "France", 65447374 ], | |
| [ "Belgium", 10839905 ], | |
| [ "Netherlands", 16680000 ] | |
| ] | |
| country_list.each do |name, population| | |
| Country.create( name: name, population: population ) | |
| end |
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
| json = ActiveSupport::JSON.decode(File.read('db/seeds/countries.json')) | |
| json.each do |a| | |
| Country.create!(a['country'], without_protection: true) | |
| end |
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
| if (navigator.geolocation) { | |
| navigator.geolocation.getCurrentPosition(function (position) { | |
| var latitude = position.coords.latitude; | |
| var longitude = position.coords.longitude; | |
| //code for displaying results | |
| //document.getElementById('show-lat-lon').innerHTML='<p>' + latitude + ' ' + longitude + '</p>'; | |
| }); | |
| } else { |
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
| if (navigator.geolocation) { | |
| navigator.geolocation.getCurrentPosition(function (position) { | |
| var latitude = position.coords.latitude; | |
| var longitude = position.coords.longitude; | |
| var coord = new google.maps.LatLng(latitude,longitude); | |
| geocoder = new google.maps.Geocoder(); | |
| geocoder.geocode({'latLng': coord}, function(results, status) { | |
| for (var i = 0; i < results[4].address_components.length; i++) { |
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
| table, caption, tbody, tfoot, thead, tr, th, td { | |
| margin: 0; | |
| padding: 0; | |
| border: 0; | |
| font-size: 100%; | |
| font: inherit; | |
| vertical-align: baseline; | |
| } | |
| table { | |
| border-collapse: collapse; |
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
| sudo -s 'echo "/usr/local/sbin/sampleapp" > /etc/paths.d/sampleapp' |
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
| iconv -f WINDOWS-1251 -t UTF-8 <upper_form.php >upper_form_utf.php |
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 telLinkTag($str = '') { | |
| $delimeter = ', '; | |
| $tels = explode($delimeter, $str); | |
| $res = array(); | |
| foreach($tels as $tel) { | |
| $invalidChar = array('(', ')', ' ', '-'); | |
| array_push($res, '<a href="' . | |
| 'tel:+' . str_replace($invalidChar, '', $tel) . | |
| '">' . | |
| $tel . |
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 subsiteLink($subdomain = false) { | |
| $ret = ''; | |
| $hostAry = explode('.', SITE_HOST); | |
| if (sizeof($hostAry) == 3 && in_array($subdomain, array('vl', 'lr'))) { | |
| if ($subdomain) { | |
| // return a link of the requested subdomain | |
| $ret = implode('.', array($subdomain, $hostAry[1], $hostAry[2])); | |
| } else { | |
| // return a link of the main domain | |
| $ret = implode('.', array($hostAry[1], $hostAry[2])); |
OlderNewer