Skip to content

Instantly share code, notes, and snippets.

View misterdev's full-sized avatar
🎧

Devid Farinelli misterdev

🎧
View GitHub Profile
@misterdev
misterdev / url-to-datauri-nodejs.js
Last active April 13, 2016 08:34
URL to DataURI converter for NodeJS without Canvas
/*
* Based on https://gist.github.com/583836 from http://stackoverflow.com/questions/3709391/node-js-base64-encode-a-downloaded-image-for-use-in-data-uri.
* /
var http = require('http')
var Stream = require('stream').Transform
http.request(url, function(response) {
var data = new Stream();
@misterdev
misterdev / info.plist
Created August 3, 2016 09:21 — forked from mlynch/info.plist
Disable App Transport Security in iOS 9
<!--
This disables app transport security and allows non-HTTPS requests.
Note: it is not recommended to use non-HTTPS requests for sensitive data. A better
approach is to fix the non-secure resources. However, this patch will work in a pinch.
To apply the fix in your Ionic/Cordova app, edit the file located here:
platforms/ios/MyApp/MyApp-Info.plist
And add this XML right before the end of the file inside of the last </dict> entry:
linear-gradient(60deg, #f79533, #f37055, #ef4e7b, #a166ab, #5073b8, #1098ad, #07b39b, #6fba82)
const Generator = require('yeoman-generator');
const { List, Input, InputValidate } = require('@webpack-cli/webpack-scaffold');
/* ... */
module.exports = class WebpackGenerator extends Generator {
constructor(args, opts) {
/* ... */
// => These are the defaults values
this.defaults = {
name: 'my-vue-project',
inFolder: 'src',
entry: 'main',
outFolder: 'dist',
writing() {
this.config.set('configuration', this.options.env.configuration);
}
@misterdev
misterdev / config-webpack-config.js
Last active March 21, 2019 14:50
webpack config
module.exports = (answers) => {
const { name, entry, inFolder: src, outFolder: dist, publicFolder } = answers;
return {
entry: `"./${src}/${entry}.js"`,
mode: '"development"',
module: {
rules: [{
test: "/\\.js$/",
exclude: "/node_modules/",
@misterdev
misterdev / index.js
Last active March 21, 2019 16:05
1.5
constructor(args, opts) {
super(args, opts);
opts.env.configurations = {
// => each key inside this object will generate a webpack
// => configuration file
dev: {
topScope: [
// => We will place here any code like
// => function definitions and imports
// => that we use in our configuration
const Generator = require('yeoman-generator');
module.exports = class WebpackGenerator extends Generator {
constructor(args, opts) {
super(args, opts);
// => We will initialize our generator here
}
prompting() {
// => This is were we will print the questions to get the user preferences
}
const Generator = require('yeoman-generator');
// => We include InputValidate
const { List, Input, InputValidate } = require('@webpack-cli/webpack-scaffold');
module.exports = class WebpackGenerator extends Generator {
/* ... */
prompting() {
// => We create a validator function that takes the user input as parameter
const validateName = (value) => {
// => If it contains space it's not a valid name