Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Launching...

Daniel Primo delineas

🚀
Launching...
View GitHub Profile
@delineas
delineas / gh-pages.yml
Created Apr 29, 2020 — forked from syuji-higa/gh-pages.yml
GitHub Actions - Genelate Nuxt.js deploy for GitHub Pages
View gh-pages.yml
name: github pages
on:
push:
branches:
- master
jobs:
build-deploy:
runs-on: ubuntu-18.04
@delineas
delineas / some_test.js
Created Jan 4, 2020 — forked from mbrochh/some_test.js
Controlling a Stripe payent popup with Cypress.io
View some_test.js
// for this to work you need to set `"chromeWebSecurity": false` in cypress.json
describe('Make Stripe Payment', function() {
before(function() {
cy.visit('http://localhost:3000/en/stripe/checkout/')
Cypress.Cookies.preserveOnce('sessionid')
})
it('should enter credit card details and finalise payment', function() {
cy.get('[data-test="button-FormStripeCart-PayWithCreditCard"]').click()
@delineas
delineas / vue.config.js
Created Dec 16, 2019
Vue Cli Static Output Names
View vue.config.js
let assetsDir = "assets";
module.exports = {
assetsDir: assetsDir,
configureWebpack: {
output: {
filename: assetsDir + "/[name].js",
chunkFilename: assetsDir + "/[name].js"
}
@delineas
delineas / convert_html_md.sh
Created Jul 30, 2019
Convert Mailchimp HTML Campaigns to Markdown
View convert_html_md.sh
# This script was created to convert a directory full of Mailchimp Campaigns html files into md equivalents.
# It uses to-markdown-cli to do the conversion.
#
# 1. Install https://www.npmjs.com/package/to-markdown-cli (you must be installed node)
# 2. Copy this script into the directory containing the .html files
# 3. Modify 'sed' init and 'sed' final conditions
# - '1,/<center>/d' -> Remove all html content from init to first <center>
# - '/Ver este mensaje en el navegador/,/<\/html>/d' -> Remove all html content from "Ver este mensaje en el navegador" text to finish
# 4. Ensure that the script has execute permissions
# 5. Run the script
View share.js
function shareSite() {
    navigator.share({
        title: document.title,
        text: 'Hello World',
        url: 'https://mewebsite.com',
    })
    .then(() => {
        console.log('Share completed successfuly')
    })
    .catch((error) => { console.log(`share failed: ${error}`) });        
@delineas
delineas / array_flatten.php
Created Jul 10, 2019 — forked from SeanCannon/array_flatten.php
PHP array_flatten() function. Convert a multi-dimensional array into a single-dimensional array.
View array_flatten.php
<?php
/**
* Convert a multi-dimensional array into a single-dimensional array.
* @author Sean Cannon, LitmusBox.com | seanc@litmusbox.com
* @param array $array The multi-dimensional array.
* @return array
*/
function array_flatten($array) {
if (!is_array($array)) {
@delineas
delineas / gist:1e55c9cb911e631174a93726b553d45e
Created May 23, 2019 — forked from johnennewdeeson/gist:22196a15b3ea115a2451
Make alt text required when uploading images using media widget (Drupal)
View gist:1e55c9cb911e631174a93726b553d45e
/**
* Implements hook_form_FORM_ID_alter().
*/
function mymodule_form_file_entity_add_upload_alter(&$form) {
_mymodule_media_form_alter($form);
}
/**
* Implements hook_form_FORM_ID_alter().
*/
@delineas
delineas / geocoding.js
Last active Apr 30, 2019
Reverse Geocoding
View geocoding.js
// From https://developer.here.com/api-explorer/rest/geocoder/reverse-geocode
$.ajax({
url: 'https://reverse.geocoder.api.here.com/6.2/reversegeocode.json',
type: 'GET',
dataType: 'jsonp',
jsonp: 'jsoncallback',
data: {
prox: '39.2134,10.0956,250721',
mode: 'retrieveAddresses',
@delineas
delineas / Flask_JWT_Auth
Created Mar 5, 2019 — forked from prameshbajra/Flask_JWT_Auth
Flask API JWT Authentication without database.
View Flask_JWT_Auth
from flask import Flask
from flask_jwt import JWT, jwt_required, current_identity
from werkzeug.security import safe_str_cmp
class User(object):
def __init__(self, id, username, password):
self.id = id
self.username = username
self.password = password
@delineas
delineas / console.js
Created Jan 1, 2019
Get All H3 Titles
View console.js
var text = [...document.getElementsByTagName('h3')].map( i => i.innerHTML )
console.table(text)
You can’t perform that action at this time.