Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.
- ⌘ : Command key
- ⌃ : Control key
- ⌫ : Delete key
- ← : Left arrow key
- → : Right arrow key
- ↑ : Up arrow key
| <?php | |
| //-------------------------------------------------------- | |
| // Example: | |
| // | |
| // $cars = [ | |
| // ['id' => 999, 'value' =>'CARS', 'parent_id' => 0 ], | |
| // ['id' => 11, 'value' =>'Toyota', 'parent_id' => 999], | |
| // ['id' => 1, 'value' =>'Avalon', 'parent_id' => 11 ], | |
| // ['id' => 2, 'value' =>'Corolla', 'parent_id' => 11 ], | |
| // ['id' => 3, 'value' =>'Camry', 'parent_id' => 11 ], |
| sudo add-apt-repository ppa:sergey-dryabzhinsky/php53 | |
| sudo apt-get update | |
| sudo apt-get install php53-common php53-cli | |
| # to see a list of available packages: | |
| # apt-cache search php53 | |
| # ex.: sudo apt-get install php53-mod-mysql | |
| # Apache module: | |
| sudo apt-get install libapache2-mod-php53 |
| $(document).ready(function() { | |
| // Function to convert an img URL to data URL | |
| function getBase64FromImageUrl(url) { | |
| var img = new Image(); | |
| img.crossOrigin = "anonymous"; | |
| img.onload = function () { | |
| var canvas = document.createElement("canvas"); | |
| canvas.width =this.width; | |
| canvas.height =this.height; | |
| var ctx = canvas.getContext("2d"); |
| $.ajax({url: "http://www.google.com/", | |
| type: "HEAD", | |
| timeout:1000, | |
| statusCode: { | |
| 200: function (response) { | |
| console.log('Status 200: Page is up!'); | |
| }, | |
| 400: function (response) { | |
| console.log('Status 400: Page is down.'); | |
| }, |
| /* | |
| How To: | |
| 1. Find your firefox profile folder : https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data | |
| 2. create a "chrome" folder if it doesn't exist | |
| 3. Paste content of this gist in a "userChrome.css" file | |
| 4. Go to about:config and set toolkit.legacyUserProfileCustomizations.stylesheets to true | |
| 5. set browser.tabs.tabmanager.enabled to false (to hide the "tab search" button) | |
| 5. Restart Firefox | |
| Don't hesitate to say if there are bugs, I only tested this for my workflow : I don't use tabs |
| /** Async version of Array.prototype.reduce() | |
| * await reduce(['/foo', '/bar', '/baz'], async (acc, v) => { | |
| * acc[v] = await (await fetch(v)).json(); | |
| * return acc; | |
| * }, {}); | |
| */ | |
| export async function reduce(arr, fn, val, pure) { | |
| for (let i=0; i<arr.length; i++) { | |
| let v = await fn(val, arr[i], i, arr); | |
| if (pure!==false) val = v; |
| --- | |
| 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 |
| /** | |
| * Change three lines | |
| * | |
| /* line 11 */ | |
| .select2-container .select2-selection--single { | |
| box-sizing: border-box; | |
| cursor: pointer; | |
| display: block; | |
| height: 34px; | |
| user-select: none; |
Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.