Skip to content

Instantly share code, notes, and snippets.

View mflisikowski's full-sized avatar
🎯
Focusing

Mateusz Flisikowski mflisikowski

🎯
Focusing
View GitHub Profile
@mflisikowski
mflisikowski / truncate_text.js
Created June 26, 2019 11:22
truncate text fun
const truncateText = (
str,
len = 42,
end = '...',
words = true,
regex = /[-.*+?^${}()|[\]\\]/g,
after = ' ',
) => {
const replaced = str.replace(regex, '');
const string = replaced.substr(0, len);
@mflisikowski
mflisikowski / .localenv
Created November 9, 2018 19:13 — forked from amlwwalker/.localenv
Configuration I have been using for connecting to MongoDB Atlas
ENVIRONMENT=development
HOSTNAME=localhost:4000
MONGODB_DB=reactnodenew
MONGODB_HOST=localhost
MONGODB_PASS=
MONGODB_PORT=27017
MONGODB_QUERIES=
MONGODB_SSL=FALSE
MONGODB_USER=
NODE_ENV=development
@mflisikowski
mflisikowski / user-model.js
Last active October 24, 2018 07:26
mongoose examples
import mongoose, { Schema } from 'mongoose'
const userSchema = new Schema({
loginInfo: {
providerID: {
type: String
},
providerKey: {
type: String
}
export function requestGet(path: string, headers?:{}){
return execute(
axios.get(api_path + path, extendHeadersWithAuthentication(headers))
)
}
export function requestPost(path: string, data : any, headers?:{}){
return execute(
axios.post(api_path + path, data, extendHeadersWithAuthentication(headers))
)
@mflisikowski
mflisikowski / app.js
Created July 26, 2018 07:07
VeeValidate - Max Dimensions Rule
import Vue from 'vue'
import pl from 'vee-validate/dist/locale/pl'
import VeeValidate, { Validator } from 'vee-validate'
import maxDimensionsRule from './maxDimensionsRule'
import Component from '@/components/Component.vue'
Validator.localize('pl', pl)
Vue.use(VeeValidate, {})
/* eslint-disable no-new */
@mflisikowski
mflisikowski / nginx.conf
Created May 30, 2018 15:51 — forked from chrisallenlane/nginx.conf
This is an nginx configuration that does the following: - Implements a RESTful API using CORS between `example.com` and `api.example.com` - Uses SSL - Reverse-proxies SSL traffic from port 443 to a NodeJS application running on port 8000 Adapted from this page, with thanks to the original author: http://enable-cors.org/server_nginx.html
# Configure the reverse-proxy on port 443
server {
# general configs
keepalive_timeout 30;
listen 127.0.0.1:443 ssl;
server_name api.example.com;
# ssl configs
ssl_certificate /path/to/api.crt;
ssl_certificate_key /path/to/api.key;
@mflisikowski
mflisikowski / cloudSettings
Last active January 18, 2019 14:59
visual-studio-code-sync
{"lastUpload":"2019-01-18T14:59:17.858Z","extensionVersion":"v3.2.4"}
@mflisikowski
mflisikowski / vue-firebase-albums-mixin.js
Created February 26, 2018 22:05
Firebase Realtime Database Albums
export default {
data() {
return {
galleryAlbums: [],
dialogAlbumImages: false
}
},
created() {
this.getAlbums()
@mflisikowski
mflisikowski / storage-thumbnails.js
Created February 21, 2018 22:12
Firebase Cloud Functions: Storage Thumbnails
'use strict'
const functions = require('firebase-functions')
const mkdirp = require('mkdirp-promise')
const gcs = require('@google-cloud/storage')({
keyFilename: '***********************************-c3d9469093.json'
})
const admin = require('firebase-admin')
const spawn = require('child-process-promise').spawn
const path = require('path')
@mflisikowski
mflisikowski / vuejs-mixin-images-firebase-add-delete.js
Last active February 21, 2018 22:09
Vuejs: Adding and Deleting images from Firebase
export default {
data() {
return {
images: []
}
},
created() {
this.getImages()
},