Skip to content

Instantly share code, notes, and snippets.

View mewben's full-sized avatar

Melvin Soldia mewben

View GitHub Profile
module.exports = {
get: function (req, res) {
res.sendfile(req.path.substr(1));
},
_config: {
rest: false,
shortcuts: false
}
};
// example.js
// ===============================
//
// Client-side (browser) example of how you might connect a socket.io client
// to your Sails backend.
// For the latest docs on talking to Sails via socket.io, check out the new reference section in the Sails docs:
// https://github.com/balderdashy/sails-docs/blob/master/reference/SocketClient.md
// As for some great tutorials, my best recommendation would be to check out @irlnathan's sailscasts:
-- Schema: public
DROP SCHEMA public CASCADE;
DROP SCHEMA retail CASCADE;
DROP SCHEMA logs CASCADE;
CREATE SCHEMA public;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO public;
COMMENT ON SCHEMA public
@mewben
mewben / gist:2febd72fc82278a447b7
Created September 26, 2015 14:16 — forked from audy/gist:52215fc35ac163006f42
dokku postgresql rsync nightly backup

dokku postgresql rsync nightly backup

This is a rough guide to automating a nightly 7-day rolling remote backup of your PostgreSQL database(s) for your dokku app(s). There is a slight difference if you are using an older version of Dokku.

This will save the comprssed output of pg_dump as well as the contents of the /home directory on your dokku machine (just in case).

You will need to create a shell script in /root and edit the cron file.

@mewben
mewben / Makefile
Created October 7, 2015 05:10 — forked from lantins/Makefile
"Auto build & serve" of golang code :)
#
# Makefile to perform "live code reloading" after changes to .go files.
#
# n.b. you must install fswatch (OS X: `brew install fswatch`)
#
# To start live reloading run the following command:
# $ make serve
#
# binary name to kill/restart
package main
import (
"net/http"
"github.com/labstack/echo"
"github.com/labstack/echo/engine/fasthttp"
)
func main() {
@mewben
mewben / esnextbin.md
Created August 4, 2016 01:52
esnextbin sketch
@mewben
mewben / webdev_online_resources.md
Created July 17, 2018 13:31 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@mewben
mewben / rounding.java
Created August 23, 2018 15:55 — forked from aslakhellesoy/rounding.java
Rounding up and down to nearest multiple
/** round n down to nearest multiple of m */
long roundDown(long n, long m) {
return n >= 0 ? (n / m) * m : ((n - m + 1) / m) * m;
}
/** round n up to nearest multiple of m */
long roundUp(long n, long m) {
return n >= 0 ? ((n + m - 1) / m) * m : (n / m) * m;
}