Skip to content

Instantly share code, notes, and snippets.

cjlaborde

Block or report user

Report or block cjlaborde

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cjlaborde
cjlaborde / gist:76b29dd66ed21889a2b0937c4998c77e
Last active May 7, 2020
How to interact with Libraries
View gist:76b29dd66ed21889a2b0937c4998c77e

How to interact with Libraries

Use querySelector

this.$refs.datepicker.$el.querySelector('.datepicker__input').click();
View React Best packages
https://github.com/final-form/react-final-form
https://github.com/airbnb/react-dates
@cjlaborde
cjlaborde / srid_units.sql
Created Apr 27, 2020 — forked from rustprooflabs/srid_units.sql
Creates view in PostGIS enabled database to make it easier to find what units each SRID is in.
View srid_units.sql
CREATE OR REPLACE VIEW public.srid_units AS
SELECT srid, CASE WHEN proj4text LIKE '%+units=%' THEN True
ELSE False
END AS units_set,
CASE WHEN proj4text LIKE '%+units=m%' THEN 'Meters'
WHEN proj4text LIKE '%+units=ft%' THEN 'Feet'
WHEN proj4text LIKE '%+units=us-ft%' THEN 'Feet'
WHEN proj4text LIKE '%+units=link%' THEN 'Link (Dunno)'
WHEN proj4text LIKE '%+units=%' THEN 'Set, not caught properly'
ELSE 'Decimal Degrees'
@cjlaborde
cjlaborde / gist:cdf7f951303a30c58a955fd391f47360
Created Apr 23, 2020 — forked from LuenCC/gist:e8dcf4a38096617799f3002644012af6
Laravel find nearest location in km from lat, long database
View gist:cdf7f951303a30c58a955fd391f47360
private function findNearestLocation(Request $request)
{
$location = DB::table('locations')
->select('name', 'latitude', 'longitude', 'region', DB::raw(sprintf(
'(6371 * acos(cos(radians(%1$.7f)) * cos(radians(latitude)) * cos(radians(longitude) - radians(%2$.7f)) + sin(radians(%1$.7f)) * sin(radians(latitude)))) AS distance',
$request->input('latitude'),
$request->input('longitude')
)))
->having('distance', '<', 50)
->orderBy('distance', 'asc')
View async await vs then catch.md

In real code, you would call makePromise().then() or await makePromise(). I assigned the promise to an intermediate variable to illustrate the difference. Which style do you prefer?

const cl = console.log

function thenCatch () {
    cl('start')
    
    const promise = makePromise()
View Server Setup
### File Limit
https://www.tecmint.com/limit-file-upload-size-in-nginx/
#### Set in http block which affects all server blocks (virtual hosts).
```
http {
...
client_max_body_size 100M;
}
View Vue stuff.md

Async calls

<template>
<p v-if="isLoading">
  Loading...
  {{ myData.if.you.try.to.access.properties.here.it.will.error }}
</p>
<p v-else>
  {{ myData.you.can.access.properties.now.that.myData.is.loaded }}
View Vue stuff.md

Async calls

<template>
<p v-if="isLoading">
  Loading...
  {{ myData.if.you.try.to.access.properties.here.it.will.error }}
</p>
<p v-else>
  {{ myData.you.can.access.properties.now.that.myData.is.loaded }}
@cjlaborde
cjlaborde / gist:794b5d475eeb2689b36de9009646933e
Last active Mar 22, 2020 — forked from yesvods/gist:51af798dd1e7058625f4
Merge Arrays in one with ES6 Array spread
View gist:794b5d475eeb2689b36de9009646933e
const arr1 = [1,2,3]
const arr2 = [4,5,6]
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
Short Version
const mergedarray = [].concat(...yourArrays);
You can’t perform that action at this time.