Skip to content

Instantly share code, notes, and snippets.

View onigetoc's full-sized avatar

Gino onigetoc

View GitHub Profile
@unknownuser88
unknownuser88 / wgetter.js
Created March 14, 2016 18:24
node download file wget
var fs = require('fs');
var url = require('url');
var exec = require('child_process').exec;
var spawn = require('child_process').spawn;
// Function to download file using wget
var download_file_wget = function(file_url, download_dir, file_name_to_save, onProgress, cb) {
// extract the file name
var file_name = url.parse(file_url).pathname.split('/').pop();
@jonobr1
jonobr1 / google-sheet-to-json.js
Last active April 26, 2024 15:41
A node.js script to convert a Google Sheet into a JSON object
/**
* Simple Node.js script to turn a specific page on a Google Sheet
* into a JSON object for the main purpose of HTML Templating.
*
* @author jonobr1 / http://jonobr1.com
*
*/
var https = require('https');
var path = require('path');
// dropzoneWordpressForm is the configuration for the element that has an id attribute
// with the value dropzone-wordpress-form (or dropzoneWordpressForm)
Dropzone.options.dropzoneWordpressForm = {
//acceptedFiles: "image/*", // all image mime types
acceptedFiles: ".jpg", // only .jpg files
maxFiles: 1,
uploadMultiple: false,
maxFilesize: 5, // 5 MB
//addRemoveLinks: true,
//dictRemoveFile: 'X (remove)',
$.getScript('https://luke-chang.github.io/js-spatial-navigation/spatial_navigation.js', function() {
$('a')
.SpatialNavigation()
.focus(function() { $(this).css('outline', '2px solid red'); })
.blur(function() { $(this).css('outline', ''); })
.first()
.focus();
});
@christophengelmayer
christophengelmayer / ajax.js
Created November 3, 2015 10:32
Vanilla JavaScript AJAX Function
var ajax = (function () {
var ajax = {};
ajax.get = function (url, callbackFunc) {
var req = prepareRequest('GET', url, callbackFunc);
req.send();
}
ajax.post = function (url, params, callbackFunc) {
var req = prepareRequest('POST', url, callbackFunc);
@christopherlovell
christopherlovell / m3u-2-JSON.R
Created November 1, 2015 21:49
m3u to JSON converter
library(rjson)
trim <- function (x) gsub("^\\s+|\\s+$", "", x)
data_dir = 'Documents/playlists/'
play_list = list()
for(i in list.files(data_dir,"^.*\\.(m3u)$")){
year = substr(i,1,4) # record file specific information, in this case year from playlist group
@scottopolis
scottopolis / wp-api-user-meta.php
Last active April 18, 2020 19:13
Add user meta to the WP-API
<?php
/* Adds all user meta to the /wp-json/wp/v2/user/[id] endpoint */
function sb_user_meta( $data, $field_name, $request ) {
if( $data['id'] ){
$user_meta = get_user_meta( $data['id'] );
}
if ( !$user_meta ) {
return new WP_Error( 'No user meta found', 'No user meta found', array( 'status' => 404 ) );
}
@mattbell87
mattbell87 / README.md
Last active July 15, 2022 08:19
jQuery plugin for Long-press

Longpress plugin for jQuery

This plugin detects a long press on any element for a specified amount of time.

Installation

  • Copy longpress.js to your website
  • Include it in your HTML after you include jQuery.

Usage

@dgp
dgp / youtube api video category id list
Created June 11, 2015 05:57
youtube api video category id list
2 - Autos & Vehicles
1 - Film & Animation
10 - Music
15 - Pets & Animals
17 - Sports
18 - Short Movies
19 - Travel & Events
20 - Gaming
21 - Videoblogging
22 - People & Blogs
@DingGGu
DingGGu / stream.js
Last active November 23, 2024 18:21
NodeJS Mp3 Streaming ExpressJS
var express = require('express');
var app = express();
var fs = require('fs');
app.listen(3000, function() {
console.log("[NodeJS] Application Listening on Port 3000");
});
app.get('/api/play/:key', function(req, res) {
var key = req.params.key;