Skip to content

Instantly share code, notes, and snippets.

lilactown /
Last active Apr 24, 2020
Notes on using JavaScript Promises in ReasonML/BuckleScript
* Making promises
let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok"));
/* Simpler promise creation for static values */
Js.Promise.reject(Invalid_argument("too easy"));
jorihardman / sumo_logic.config
Last active May 25, 2020
Elastic Beanstalk Sumo Logic Config
View sumo_logic.config
# This will automatically install the Sumo Logic collector on AWS Elastic
# Beanstalk instances. Add this to the .ebextensions folder in your app root
# and edit L24-25 to match your Sumo Logic accessid and accesskey. To add or
# remove tracked files, simply add or remove source hashes to the sources
# array on L36.
crypto = require('crypto');
#Quick MD5 of text
text = "MD5 this text!"
md5hash1 = crypto.createHash('md5').update(text).digest("hex")
#MD5 of text with updates
m = crypto.createHash('md5')
m.update("MD5 ")
m.update("this ")
ramn / Deserialization.scala
Last active Mar 7, 2021
Object serialization example in Scala
View Deserialization.scala
class Animal(name: String, age: Int) extends Serializable {
override def toString = s"Animal($name, $age)"
case class Person(name: String)
// or fork := true in sbt
delikat / next.config.js
Last active Aug 4, 2021
Modular antd imports with next.js, next-less, next-typescript, and babel-plugin-import
View next.config.js
const withLess = require('@zeit/next-less')
const withTypescript = require('@zeit/next-typescript')
const resolve = require('resolve')
module.exports = withTypescript(withLess({
lessLoaderOptions: {
javascriptEnabled: true,
// theme antd here
modifyVars: {'@primary-color': '#1Dd57A'}
mcdougal / _error.js
Created Sep 28, 2018
Using @sentry/browser with Next.js for client and server-side rendering
View _error.js
import * as Sentry from '@sentry/browser';
import getConfig from 'next/config';
import React from 'react';
const { SENTRY_DSN } = getConfig().publicRuntimeConfig;
Sentry.init({ dsn: SENTRY_DSN });
* Send an error event to Sentry.
View gist:603980
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
santoshachari / nginx.default.conf
Last active Oct 15, 2021 — forked from sumardi/nginx.default.conf
PHP5.6 and NGINX: Install PHP56-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
View nginx.default.conf
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and php56-FPM
sudo yum install -y nginx php56-fpm
# Install php56 extensions
sudo yum install -y php56-devel php-mysql php56-pdo php56-pear php56-mbstring php56-cli php56-odbc php56-imap php56-gd php56-xml php56-soap
View gist:3e68169e1689d03e4412af23439932c6
# First, install all of the things
sudo su
apt-get update
apt-get install nginx
/etc/init.d/nginx start
apt-get install python-dev
apt-get install python-pip
apt-get install libjpeg-dev libpng-dev libtiff-dev libjasper-dev libgtk2.0-dev python-numpy python-pycurl libwebp-dev python-opencv libjpeg-progs
ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib
iansltx /
Last active Oct 21, 2021
Safari iframe cookie workaround