Skip to content

Instantly share code, notes, and snippets.

View ArunMichaelDsouza's full-sized avatar

Arun Michael Dsouza ArunMichaelDsouza

View GitHub Profile
@ArunMichaelDsouza
ArunMichaelDsouza / nginx.default.conf
Created January 28, 2016 09:45
Default NGINX Configuration
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@ArunMichaelDsouza
ArunMichaelDsouza / app.js
Created April 3, 2019 09:55
Woodlot middlewareLogger config
var express = require('express');
var app = express();
var woodlot = require('woodlot').middlewareLogger;
app.use(woodlot({
streams: ['./logs/app.log'],
stdout: false,
routes: {
whitelist: ['/api', '/dashboard'],
strictChecking: false
@ArunMichaelDsouza
ArunMichaelDsouza / spree.rb
Last active May 9, 2021 04:54
Solidus config for S3 file upload + CDN (Cloudfront) delivery
# Upload new product images to S3 and deliver via Cloudfront
Spree.config do |config|
attachment_config = {
s3_credentials: {
access_key_id: ENV.fetch("S3_ACCESS_KEY"),
secret_access_key: ENV.fetch("S3_SECRET"),
bucket: ENV.fetch("S3_BUCKET"),
},
@ArunMichaelDsouza
ArunMichaelDsouza / text-detection.html
Last active January 31, 2021 01:20
Text Detection using the Shape Detection API
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Text Detection using the Shape Detection API</title>
<style>
body {
margin: 0 4px;
font-family: sans-serif;
@ArunMichaelDsouza
ArunMichaelDsouza / barcode-detection.html
Last active January 31, 2021 00:24
Barcode Detection using the Shape Detection API
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Baracode Detection using the Shape Detection API</title>
<style>
body {
margin: 0 4px;
font-family: sans-serif;
@ArunMichaelDsouza
ArunMichaelDsouza / face-detection.html
Last active January 30, 2021 21:22
Face Detection using the Shape Detection API
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Face Detection using the Shape Detection API</title>
<style>
body {
margin: 0;
font-family: sans-serif;
@ArunMichaelDsouza
ArunMichaelDsouza / lerna.txt
Last active February 27, 2020 10:23
Lerna basic usage
1) Initialise lerna
> lerna init
2) Create packages
> cd packages && mkdir package1 && cd package1 && yarn init -y
or
> lerna create package1 -y // This would scaffold a package directory
3) Add dependencies
> lerna add package2 // Installs dependency to all packages except package2
> lerna add package2 --scope=package1 // Installs package2 only to package1
> yarn add package2 // Installs global(top-level) dependency
@ArunMichaelDsouza
ArunMichaelDsouza / html-to-canvas.js
Created January 30, 2020 16:40
Rendering HTML on the canvas as an SVG image blob.
const data = `
<svg xmlns="http://www.w3.org/2000/svg">
<foreignObject width="100%" height="100%">
<div xmlns="http://www.w3.org/1999/xhtml" style="border: 2px solid red; padding: 20px;">
<span style="font-size: 22px;">This will be rendered on the canvas.</span>
</div>
</foreignObject>
</svg>
`;
const svg = new Blob([data], { type: 'image/svg+xml;charset=utf-8' });
@ArunMichaelDsouza
ArunMichaelDsouza / react-image-appear-demo.js
Last active April 25, 2019 10:47
react-image-appear demo
import React from 'react';
import ReactImageAppear from 'react-image-appear';
class MyComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
@ArunMichaelDsouza
ArunMichaelDsouza / app.js
Created April 3, 2019 11:07
Woodlot customLogger config
var express = require('express');
var app = express();
var woodlotCustomLogger = require('woodlot').customLogger;
var woodlot = new woodlotCustomLogger({
streams: ['./logs/custom.log'],
stdout: false,
format: {
type: 'json',
options: {