Skip to content

Instantly share code, notes, and snippets.

View danielzzz's full-sized avatar
🧑‍🚀
Music, Arts and IT

dan zelisko danielzzz

🧑‍🚀
Music, Arts and IT
  • palma de mallorca, spain
View GitHub Profile
@danielzzz
danielzzz / .gitlab-ci.yaml
Last active March 30, 2022 15:10
docker 20 with dind for gitlab runner
image: some-image
# dind is necessary for docker
services:
- name: docker:20.10.10-dind
alias: docker
# THIS IS IMPORTANT!
command: ["--tls=false"]
@danielzzz
danielzzz / wpfetch.js
Last active January 18, 2021 14:06
fetch wp (wordpress) example file upload how to avoid error 400 wp api json
// dont forget to activate your endpoint in the plugin
// $this->loader->add_action('wp_ajax_nopriv_upload_answer', $plugin_public, 'upload_answer');
// $this->loader->add_action('wp_ajax_upload_answer', $plugin_public, 'upload_answer');
//--------- js code ---------------------
const url = "/admin-ajax.php";
//el -> an file input element
const data = new FormData();
//append files
for (const file of el.files) {
console.log('adding', file.name);
<?php
namespace App\Controller\Admin;
use App\Controller\AppController;
use \PhpExcel;
use \PhpExcel\IOFactory;
/**
* Members Controller
*
var mongoose = require('./lib/mongoose/mongoose').Mongoose;
var db = mongoose.connect('mongodb://localhost/testdb');
var User = db.model('User');
var t = {'title': 'test'}
var u = new User(t, true);
u.isNew = true; //important!
u.save(function(){
console.log('saved');
console.log(u);
db.close();