Skip to content

Instantly share code, notes, and snippets.

View vparaskevas's full-sized avatar

Vasileios Paraskevas vparaskevas

View GitHub Profile
@sarfarazansari
sarfarazansari / nodejs_aws_s3_file_upload.js
Last active March 15, 2024 09:40
How to upload files to AWS S3 with NodeJS - AWS-SDK? With the help of this library you can upload any kind of file to s3. (NODEJS, AWS-SDK, S3)
/**
* we are going to upload file to s3 via node js by using
* aws-sdk - required
* busboy - required
* uuid - optional - for image renaming purpose
* with this library you can upload any kind of file to s3 via node js.
*/
const AWS = require('aws-sdk');
const UUID = require('uuid/v4');
@zepster
zepster / index.js
Created April 16, 2018 17:52
date range
const Moment = require('moment');
const MomentRange = require('moment-range');
require('moment-recur');
export const moment = MomentRange.extendMoment(Moment);
export const DAY_SLOT = 'day'
export const HOUR_SLOT = 'hour'
export const SECOND_SLOT = 'second'
@fabulator
fabulator / locale.json
Created January 17, 2018 11:32
List of Facebook locales (from user settings)
{
"so_SO":"Af-Soomaali",
"af_ZA":"Afrikaans",
"az_AZ":"Azərbaycan dili",
"id_ID":"Bahasa Indonesia",
"ms_MY":"Bahasa Melayu",
"jv_ID":"Basa Jawa",
"cx_PH":"Bisaya",
"bs_BA":"Bosanski",
"br_FR":"Brezhoneg",
@felipeochoa
felipeochoa / quill-blots.org
Created January 13, 2018 17:13
Notes to self on blots in quill

Quill Blots

There are four options for creating a custom blot:

---------------+-------+

InlineBlock

---------------+-------+

Embed

---------------+-------+

Text
@SylarRuby
SylarRuby / userAvatar.js
Last active June 21, 2024 14:48
NodeJs AWS S3 Upload
/**
* This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from
* a base64 string.
* Updated to use Promise (bluebird)
* Web: https://mayneweb.com
*
* @param {string} base64 Data
* @return {string} Image url
*/
const imageUpload = async (base64) => {
@kentoj
kentoj / closure-table-operations.sql
Last active January 19, 2025 14:50 — forked from emmanuel/file.sql
Closure Table operations SQL fragments
-- Retrieve descendants
-- ====================
-- retrieve descendants of #4
SELECT c.*
FROM Comments AS c
JOIN TreePaths AS t ON c.comment_id = t.descendant
WHERE t.ancestor = 4;
-- Retrieve ancestors
@saiumesh535
saiumesh535 / somefile.js
Last active February 8, 2018 23:01
Async await without try catch
// traditional way of writing code
const router = require('express').Router();
router.get('/check', check);
module.exports = router;
async function check(req, res) {
someOtherFunction().then((a) => {
somethingElseFunction().then((b) => {
res.status(200).json({a: a, b: b});
}).catch((error) => {
@shelldandy
shelldandy / App.js
Created October 17, 2017 19:08
nprogress with react-router in create-react-app
import React from 'react'
import { BrowserRouter as Router, Switch } from 'react-router-dom'
import routes from './routes'
import FancyRoute from './components/tools/FancyRoute'
const App = props =>
<Router>
<Switch>
{routes.map((route, i) =>
<FancyRoute key={i} {...route} />
@vasiltabakov
vasiltabakov / FigureOptions.ts
Created October 7, 2017 09:47
Quill editor editable image caption
import Quill from 'quill';
import {TaskerFigure} from './TaskerFigure';
import Parchment from 'parchment';
export class FigureOptions {
quill: Quill;
figure;
overlay;
linkRange;
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active October 14, 2024 15:38
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation