Skip to content

Instantly share code, notes, and snippets.

@mjurincic
mjurincic / markdown-cheatsheet.md
Created July 12, 2016 11:52 — forked from james2doyle/markdown-cheatsheet.md
Another markdown cheatsheet. More straightforward examples.

Any block of text surrounded by line breaks is considered a paragraph.

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Alternatively, for H1 and H2, an underline-ish style:

@mjurincic
mjurincic / Sortable.jsx
Created January 13, 2017 10:17 — forked from superKalo/ Sortable.jsx
How to use jQuery UI with React JS? You can use this approach to integrate almost any jQuery plugin! Full details and explanation here: http://stackoverflow.com/a/40350880/1333836
class Sortable extends React.Component {
componentDidMount() {
// Every React component has a function that exposes the
// underlying DOM node that it is wrapping. We can use that
// DOM node, pass it to jQuery and initialize the plugin.
// You'll find that many jQuery plugins follow this same pattern
// and you'll be able to pass the component DOM node to jQuery
// and call the plugin function.
@mjurincic
mjurincic / server.js
Created January 28, 2017 16:14 — forked from nodkz/apolloServer2019.ts
GraphQL error tracking with sentry.io
/* eslint-disable no-console, import/first */
import path from 'path';
import express from 'express';
import expressStaticGzip from 'express-static-gzip';
import graphqlHTTP from 'express-graphql';
import PrettyError from 'pretty-error';
import bodyParser from 'body-parser';
import raven from 'raven';
import morgan from 'morgan';
import { graphqlBatchHTTPWrapper } from 'react-relay-network-layer';
@mjurincic
mjurincic / relayStore.js
Created January 28, 2017 16:17 — forked from nodkz/relayStore.js
relayStore with `reset` and simplified `mutate` methods
let relayStore;
function relayCreateStore() {
const env = new Relay.Environment();
env.injectNetworkLayer(new Relay.DefaultNetworkLayer('/graphql'));
if (__DEV__) {
RelayNetworkDebug.init(env);
}
env.reset = () => relayCreateStore();
env.mutate = ({
query,
@mjurincic
mjurincic / routes.js
Created January 28, 2017 16:19 — forked from nodkz/routes.js
import React from 'react';
import Relay from 'react-relay';
import { relayStore } from 'app/clientStores'; // relayStore = Relay.Store;
import App from 'app/_components/App/App';
import Menu from 'app/Menu/Menu';
import MainPage from 'app/MainPage/MainPage';
import Page404 from 'app/_components/Page404/Page404';
import LoadingPage from 'app/_components/LoadingPage/LoadingPage';
import BrokenPage from 'app/_components/BrokenPage/BrokenPage';
@mjurincic
mjurincic / cache.js
Created August 8, 2017 13:32
express caching
var express = require('express');
var app = express();
var mcache = require('memory-cache');
app.set('view engine', 'jade');
var cache = (duration) => {
return (req, res, next) => {
let key = '__express__' + req.originalUrl || req.url
let cachedBody = mcache.get(key)
@mjurincic
mjurincic / nginx.conf
Last active June 30, 2022 16:05 — forked from tomysmile/node-setup-pm2-nginx.md
Setup NodeJS Production with PM2, Nginx on AWS Ubuntu 16.04 server
proxy_http_version 1.1;
proxy_set_header Connection "";
https://gist.github.com/miguelmota/6912559
# The upstream module is the link between Node.js and Nginx.
# Upstream is used for proxying requests to other servers.
# All requests for / get distributed between any of the servers listed.
upstream helloworld {
# Set up multiple Node.js webservers for load balancing.
# max_fails refers to number of failed attempts
# before server is considered inactive.
@mjurincic
mjurincic / logrotate-nginx
Created September 18, 2017 08:58 — forked from aputs/logrotate-nginx
logrotate config for nginx
/var/log/nginx_*.log {
daily
compress
delaycompress
rotate 2
missingok
nocreate
sharedscripts
postrotate
test ! -f /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid`
@mjurincic
mjurincic / lex-stream.js
Created October 11, 2017 11:27 — forked from chrisradek/lex-stream.js
Streaming Polly Audio into Lex
var path = require('path');
var fs = require('fs');
var AWS = require('aws-sdk');
var polly = new AWS.Polly();
var lexRuntime = new AWS.LexRuntime();
async function run() {
var audioStream = polly.synthesizeSpeech({