Skip to content

Instantly share code, notes, and snippets.

View jaronwanderley's full-sized avatar

Jaron Wanderley jaronwanderley

View GitHub Profile
@bravo-kernel
bravo-kernel / feathersjs-swagger.js
Last active November 24, 2020 21:49
Working example of feathers-swagger with the swagger definition in a service (not in app.js)
// -----------------------------------------------------
// projects.service.js
// -----------------------------------------------------
// Initializes the `projects` service on path `/projects`
const createService = require('feathers-sequelize');
const createModel = require('../../models/projects.model');
const hooks = require('./projects.hooks');
module.exports = function (app) {
const Model = createModel(app);
@tanaikech
tanaikech / submit.md
Last active August 22, 2025 11:57
Upload Files to Google Drive using Javascript

Upload Files to Google Drive using Javascript

News

At October 11, 2019, I published a Javascript library to to run the resumable upload for Google Drive. When this is used, the large file can be uploaded. You can also use this js library.

Description

This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create() can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.

  • This sample uses gapi.
  • Before you use this, please enable Drive API at API console and carr
@loilo
loilo / pass-slots.md
Last active October 31, 2025 07:28
Vue: Pass Slots through from Parent to Child Components

Vue: Pass Slots through from Parent to Child Components

The Situation

  • We've got some components A, B and C which provide different slots.
    const A = {
      template: `<div><slot name="a">Default A Content</slot></div>`
    }

const B = {

@Sheep-y
Sheep-y / jsPDF.code39.md
Last active July 9, 2021 11:38
Code 39 barcode drawing function for jsPDF

Adds a jsPDF method to draw a Code 39 barcode in line vector, which is very small and retain perfect sharpness at all resolutions. An optional matrix can be supplied for rotation, sheer, mirror, or other effects.

Does not render text; the drawn barcode is perfectly rectangular. Does not validate text input. Requires EcmaScript 7.

Usage

const doc = new jsPDF();
// Draw at [50,50], width 100. height 20.

doc.code39( "0123456789", 50, 30, 100, 20 );

setTimeout(function() {
function getAllModules() {
return new Promise((resolve) => {
const id = _.uniqueId("fakeModule_");
window["webpackJsonp"](
[],
{
[id]: function(module, exports, __webpack_require__) {
resolve(__webpack_require__.c);
}
@ianholing
ianholing / simpletest_raspicam.cpp
Created June 12, 2018 07:27
First attempt for detecting bright points
#include <ctime>
#include <fstream>
#include <iostream>
#include <sstream>
#include <stdlib.h>
#include <unistd.h>
#include <raspicam/raspicam.h>
#include <signal.h>
//#include <stdlib.h>
<template>
<!-- Will add/remove .small if the width is less / greater -->
<div class="post__item" v-responsive="{ small: el => el.width <= 500 }">
<img class="post__image" :src="post.image" />
<div class="post__text">{{post.text}}</div>
</div>
</template>
<script>
import { ResponsiveDirective } from "vue-responsive-components"
//Task: Find the greatest common divisor for an array of integers
//Tags: array, gcd
let arr = [6, 9, 21]
let gcd = function(a, b) {
a = Math.abs(a)
b = Math.abs(b)
while (a != b) {
if (a > b) a -= b
@elclanrs
elclanrs / README.md
Last active July 4, 2025 13:23
VanillaJS popover with autoposition
@jcormont
jcormont / barcode-128-svg.js
Created October 12, 2017 15:00
Simple Code-128 (128B) barcode SVG generator, in vanilla JS
var Barcode128Svg = (function () {
function Barcode128Svg(input) {
this.input = input;
this.factor = 2;
this.height = 75;
}
var lookup = {}, data = "212222222122222221121223121322131222122213122312132212221213221312231212112232122132122231113222123122123221223211221132221231213212223112312131311222321122321221312212322112322211212123212321232121111323131123131321112313132113132311211313231113231311112133112331132131113123113321133121313121211331231131213113213311213131311123311321331121312113312311332111314111221411431111111224111422121124121421141122141221112214112412122114122411142112142211241211221114413111241112134111111242121142121241114212124112124211411212421112421211212141214121412121111143111341131141114113114311411113411311113141114131311141411131".split(/(\d{6})/).filter(function (s) { return !!s });
for (var i = 32; i < 127; i++)
lookup[String.fromCharCode(i)] = [i - 32, data[i - 32]];