Skip to content

Instantly share code, notes, and snippets.

View mapsi's full-sized avatar

Angel Psiakis mapsi

View GitHub Profile
@belsrc
belsrc / gist:672b75d1f89a9a5c192c
Last active April 15, 2023 15:13
Simple Vue.js filters that I usually need
/**
* Changes value to past tense.
* Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc.
* http://jsfiddle.net/bryan_k/0xczme2r/
*
* @param {String} value The value string.
*/
Vue.filter('past-tense', function(value) {
// Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing
var vowels = ['a', 'e', 'i', 'o', 'u'];
@wojas
wojas / docker-compose.yml
Created June 3, 2016 06:29
docker-compose for nginx with php5-fpm using small alpine images
version: '2'
services:
php:
image: php:5.6-fpm-alpine
volumes:
- data:/_data
- ./site:/var/www/html:ro
networks:
- backend
command: sh -c 'chown www-data /_data && exec php-fpm'
@javilobo8
javilobo8 / download-file.js
Last active October 27, 2024 09:15
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@chrisjpatty
chrisjpatty / maskDate.js
Last active April 6, 2024 15:27
Javascript date Input mask MM/DD/YYYY
const maskDate = value => {
let v = value.replace(/\D/g,'').slice(0, 10);
if (v.length >= 5) {
return `${v.slice(0,2)}/${v.slice(2,4)}/${v.slice(4)}`;
}
else if (v.length >= 3) {
return `${v.slice(0,2)}/${v.slice(2)}`;
}
return v
}
@candlerb
candlerb / go-project-layout.md
Last active October 1, 2024 08:33
Suggestions for go project layout

If someone asked me the question "what layout should I use for my Go code repository?", I'd start by asking back "what are you building: an executable, or a library?"

Single executable

Stage 1: single source file

Create a directory named however you want your final executable to be called (e.g. "mycommand"), change into that directory, and create the following files: