Skip to content

Instantly share code, notes, and snippets.

View jamigibbs's full-sized avatar

Jami Gibbs jamigibbs

View GitHub Profile
const coords = data.results.map((station) => {
const coord = station.geometry.location
})
const data = "results": [
{
"geometry": {
"location": {
"lat": 41.8921794,
"lng": -87.6366551,
},
"viewport": {
"northeast": {
"lat": 41.89363007989272,
@jamigibbs
jamigibbs / getNearestDivvyStation.js
Last active June 19, 2018 00:58
a) getNearestDivvyStation
export const getNearestDivvyStation = (lat, lng) => {
const url = `${GOOGLE_PLACES_URL}?location=${lat},${lng}&radius=1000&type=point_of_interest&keyword=divvy&key=${API_KEY}`
return async (dispatch) => {
const { data } = await axios.get(url)
}
}
@jamigibbs
jamigibbs / gist:0bdb553f5cbc5a08cfe17d8ec4e631c4
Last active June 19, 2018 00:36
Google Places Radius Query
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=${lat},${lng}&radius=1000&type=point_of_interest&keyword=divvy&key=${API_KEY}
@jamigibbs
jamigibbs / getCurrentLocation.js
Last active June 18, 2018 18:37
Expo Geolocation with emulator check
export const getCurrentLocation = (simulator) => {
return async (dispatch) => {
if (!simulator) {
let { status } = await Permissions.askAsync(Permissions.LOCATION);
if (status !== 'granted') {
dispatch(gotCurrentLocationError('Permission to access location was denied'))
}
let location = await Location.getCurrentPositionAsync({});
Test.assertEquals(solve([8,1,2,7],12),true);
Test.assertEquals(solve([2,5,4,9,1],90),true);
Test.assertEquals(solve([9,8,2],90),true);
Test.assertEquals(solve([6,7,3,8],80),true);
Test.assertEquals(solve([2,7,4,3],70),true);
Test.assertEquals(solve([5,9,7,8,6],90),true);
Test.assertEquals(solve([7,1,2,5,4],70),true);
Test.assertEquals(solve([1,9,5],90),true);
Test.assertEquals(solve([4,9,3,6],90),true);
<?php
function mytheme_avoid_fouc(){
echo '<script type="text/javascript">document.documentElement.className = \'js\';</script>';
}
add_action( 'wp_head', 'mytheme_avoid_fouc', 1);
@jamigibbs
jamigibbs / round-img.html
Created August 9, 2016 19:38
Accounting for rectangular images for round display
<div class="rounded-image" style="background-image:url(link/to/image.png);">
<img class="hidden" src="link/to/image.png" title="This is just for SEO">
</div>
.rounded-image{
background-size: cover;
background-position: center center;
width: 150px;
height: 150px;
@jamigibbs
jamigibbs / remove_redux_notices.php
Last active July 30, 2016 01:46
Remove Redux Notices
<?php
if ( ! function_exists( 'theme_name_remove_anonymous_object_filter' ) ){
/**
* Remove an anonymous object filter.
*
* @param string $tag Hook name.
* @param string $class Class name
* @param string $method Method name
* @return void
<?php
// This is an example of how to include a plugin from the WordPress Plugin Repository.
array(
'name' => esc_html__( 'WooCommerce', 'text-domain' ),
'slug' => 'woocommerce',
'required' => false,
),
// This is an example of how to include a plugin bundled with a theme.