Skip to content

Instantly share code, notes, and snippets.

View martpie's full-sized avatar
🇨🇵

Pierre de la Martinière martpie

🇨🇵
View GitHub Profile
@martpie
martpie / ActiveLink.tsx
Created July 26, 2019 11:53
ActiveLink component for Next.js 9
@martpie
martpie / render404Error.ts
Created June 14, 2019 12:08
Return a 404 from a Next.js page render method (ssr + client-side)
import React from 'react';
import ErrorPage from 'next/error';
// Allow to render the error page + return the correct error code with SSR
// It is a hack and has the disadvantage of logging this server-side
// https://github.com/zeit/next.js/issues/4451
// A better solution is welcome.
export const render404Error = () => {
if (process.browser) {
@martpie
martpie / small-js-exercises.js
Last active January 19, 2018 12:45
Small JS exercises
/**
* Small JS exercices
* Consider all exercises independant from each other and running in their own scope
*
*/
/**
* What is the output of this piece of code?
*
*/
@martpie
martpie / keymap.cson
Last active October 7, 2021 09:41
Get emmet-atom working fine with Atom and autocomplete-plus
# Will make autocomplete trigger with 'enter' instead of 'tab'
'atom-text-editor:not(mini) .autocomplete-plus.autocomplete-suggestion-list':
'tab': 'unset!'
'enter': 'autocomplete-plus:confirm'
# Use 'expand-abbreviation' instead of 'expand-abbreviation-with-tab' for tab keybinding
'.pane .editor:not(.mini)':
'tab': 'emmet:expand-abbreviation'
@martpie
martpie / gmaps.html
Created August 20, 2014 09:31
Google Maps v3 API snippet
<!-- Map -->
<div id="map_canvas" class="relative" style="height:600px;z-index: 4;"></div>
<!-- Maps Generator -->
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
window.onload = function() {
initialize();
}
/* Pierre de la Martinière
*
* display all languages avalaible for a Wordpress Theme using WPML
* directly echo something like "en fr it ru" ...
*
* more info at http://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/
*
*/
//[wpml_lang_selector]