Skip to content

Instantly share code, notes, and snippets.

@gauravtiwari
gauravtiwari / window-auth-popup.es6.js
Last active April 12, 2024 00:56
Promise based popup window for server oAuth
/* global window */
const popup = (url) => {
const windowArea = {
width: Math.floor(window.outerWidth * 0.8),
height: Math.floor(window.outerHeight * 0.5),
};
if (windowArea.width < 1000) { windowArea.width = 1000; }
if (windowArea.height < 630) { windowArea.height = 630; }
@gauravtiwari
gauravtiwari / seaweedfs_owncloud.md
Created September 23, 2021 08:36 — forked from egg82/seaweedfs_owncloud.md
SeaweedFS + OwnCloud

A quick write-up on SeaweedFS + OwnCloud

This guide aims to take a look at a distributed, scalable SeaweedFS as a backend storage for an OwnCloud server. Why not NextCloud? Because NextCloud's S3 connector is outdated and not maintained, and won't work with SeaweedFS. Both OwnCloud and NextCloud have the same support and the same plugins. The only concern anyone has is some weird split that happened between the two years ago. It's fine.

This was a giant pain in the ass, but eventually I got it working. This is how.

Filesystem/Hardware

All servers start from fresh, clean installs of Ubuntu 18.04.3

This guide will use three seperate boxes (one master/OwnCloud and two slaves). I'm assuming there's spare, unformatted disks attached to the slaves. If not, ignore or change the section on mounting to fit your needs.

@gauravtiwari
gauravtiwari / counter.js
Created February 19, 2017 11:59
A simple counter example using vanilla JS
// A simple counter example
// The setup will be more complicated in modern apps built using React
const incrementNode = document.getElementById('increment');
const decrementNode = document.getElementById('decrement');
const inputNode = document.getElementById('counter');
const counter = {
initialize() {
incrementNode.addEventListener('click', (event) => {
@gauravtiwari
gauravtiwari / Gemfile
Last active March 26, 2017 09:07
Gemfile_edge
source 'https://rubygems.org'
ruby '2.2.6'
gem 'rails', '~> 5.1.x'
gem 'sprockets', '~> 4.x'
heroku create
heroku addons:create heroku-postgresql:hobby-dev
git push heroku master
@gauravtiwari
gauravtiwari / shared.js
Last active February 22, 2017 12:17
Shared webpack config
// Note: You must restart bin/webpack-watcher for changes to take effect
var path = require('path');
var glob = require('glob');
var extname = require('path-complete-extname');
var distPath = process.env.WEBPACK_DIST_PATH;
if (distPath === undefined) {
distPath = 'packs'
}
@gauravtiwari
gauravtiwari / index.js
Created February 19, 2017 12:24
Counter index initializer
// Initialize the counter code when DOM is ready
import './style.sass';
import counter from './counter';
document.addEventListener('DOMContentLoaded', () => {
counter.initialize();
});
@gauravtiwari
gauravtiwari / style.sass
Created February 19, 2017 12:23
Counter style
$grey: #f2f2f2
.counter-wrapper
max-width: 500px
margin: 100px auto
padding: 10px
border: 1px solid $grey
form
@gauravtiwari
gauravtiwari / counter.js
Created February 19, 2017 12:01
Counter entry file
// Require or import the counter module
import '../counter';
@gauravtiwari
gauravtiwari / index.js
Created February 19, 2017 12:00
Initialise counter on DOM ready
// Initialize the counter code when DOM is ready
import counter from './counter';
document.addEventListener('DOMContentLoaded', () => {
counter.initialize();
});