Skip to content

Instantly share code, notes, and snippets.

View LoicMahieu's full-sized avatar
🙈
🙊

Loïc Mahieu LoicMahieu

🙈
🙊
View GitHub Profile
@rodneyrehm
rodneyrehm / sentry-clean-debug-information-files.js
Created July 17, 2019 15:19
Sentry Cleanup: Debug Information Files
const axios = require('axios')
const LinkHeader = require('http-link-header')
const nextPage = (header) => {
const link = LinkHeader.parse(header)
const [ next ] = link.get('rel', 'next')
return next && next.results === 'true' ? next.uri : null
}
@ephys
ephys / FormattedMessageTag.js
Last active June 2, 2018 13:24
An extension to React-Intl to format messages that contain XML
// @flow
// V2 on NPM fixes notes below
// https://github.com/Ephys/react-intl-formatted-xml-message
// NOTE: Currently with this implementation, XML present in the variables you pass to FormattedMessageTag will also be converted to react components.
// I'm working on a way to fix this issue. Right now I think that'll mean re-implementing FormattedMessage so the XML parsing part skips {variable} tags
// TODO:
// Replace all object or string values with placeholder tags
@adyngom
adyngom / fn-args-required.js
Last active September 26, 2017 13:56
Javascript ES6 function with required arguments example
const throwIfMissing = (p) => { throw new Error(`Missing parameter: ${p}`); }
function famTree(dad = throwIfMissing("dad"),mom = throwIfMissing("mom"),...siblings) {
console.group("Family");
console.log(`Dad: ${dad}`);
console.log(`Mom: ${mom}`);
if(siblings.length > 0) {
console.log(`Siblings: ${siblings.join()}`);
}
console.groupEnd();
@peggyrayzis
peggyrayzis / .babelrc
Last active February 7, 2019 03:31
Webpack 2 + PWA support (Tree Shaking, Code Splitting w/ React Router v4, Service Worker)
{
"presets": [
"react",
"stage-2",
[
"env",
{
"targets": {
"browsers": [
"last 2 versions",
@so0k
so0k / kubectl.md
Last active April 25, 2024 12:40
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@gaearon
gaearon / slim-redux.js
Last active May 5, 2024 15:14
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@guedressel
guedressel / font-awesome-mime-type-icons.php
Last active October 13, 2022 09:30
Font Awesome File Icons: Mapping MIME Types to correct icon classes
<?php
/**
* Get font awesome file icon class for specific MIME Type
* @see https://gist.github.com/guedressel/0daa170c0fde65ce5551
*
*/
function font_awesome_file_icon_class( $mime_type ) {
// List of official MIME Types: http://www.iana.org/assignments/media-types/media-types.xhtml
@creationix
creationix / .jshintrc
Created November 7, 2014 00:45
Sublime Settings
{
// JSHint Default Configuration File (as on JSHint website)
// See http://jshint.com/docs/ for more details
"maxerr" : 50, // {int} Maximum error before stopping
// Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
@marlun78
marlun78 / $once.js
Last active February 28, 2018 19:19
Angular $rootScope.Scope.$once
/**
* Angular $rootScope.Scope.$once
* Copyright (c) 2014 marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*/
$provide.decorator('$rootScope', function ($delegate) {
var Scope = $delegate.__proto__.constructor;
Scope.prototype.$once = function (name, listener) {
var deregister = this.$on(name, function () {
deregister();
var dom = Bloop.dom;
var Box = Bloop.createClass({
getInitialState: function() {
return { number: 0 };
},
updateNumber: function() {
this.state.number++;
},