Skip to content

Instantly share code, notes, and snippets.

View delineas's full-sized avatar
🚀
Launching...

Daniel Primo delineas

🚀
Launching...
View GitHub Profile
@delineas
delineas / gh-pages.yml
Created April 29, 2020 09:25 — forked from syuji-higa/gh-pages.yml
GitHub Actions - Genelate Nuxt.js deploy for GitHub Pages
name: github pages
on:
push:
branches:
- master
jobs:
build-deploy:
runs-on: ubuntu-18.04
@delineas
delineas / some_test.js
Created January 4, 2020 10:09 — forked from mbrochh/some_test.js
Controlling a Stripe payent popup with Cypress.io
// 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 December 16, 2019 10:42
Vue Cli Static Output Names
let assetsDir = "assets";
module.exports = {
assetsDir: assetsDir,
configureWebpack: {
output: {
filename: assetsDir + "/[name].js",
chunkFilename: assetsDir + "/[name].js"
}
@delineas
delineas / convert_html_md.sh
Created July 30, 2019 18:32
Convert Mailchimp HTML Campaigns to Markdown
# 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
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 July 10, 2019 16:21 — forked from SeanCannon/array_flatten.php
PHP array_flatten() function. Convert a multi-dimensional array into a single-dimensional array.
<?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 13:32 — forked from johnennewdeeson/gist:22196a15b3ea115a2451
Make alt text required when uploading images using media widget (Drupal)
/**
* 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 / Flask_JWT_Auth
Created March 5, 2019 23:40 — forked from prameshbajra/Flask_JWT_Auth
Flask API JWT Authentication without database.
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 January 1, 2019 20:37
Get All H3 Titles
var text = [...document.getElementsByTagName('h3')].map( i => i.innerHTML )
console.table(text)
@delineas
delineas / sample.sol
Created December 10, 2018 09:28
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
pragma solidity >=0.4.22 <0.6.0;
contract SampleContract {
uint storageData;
function set(uint x) public {
storageData = x;
}
function get() public view returns (uint) {
return storageData;
}