Skip to content

Instantly share code, notes, and snippets.

View onigetoc's full-sized avatar

Gino onigetoc

View GitHub Profile
// 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;
@hideokamoto
hideokamoto / get_hot_tag.html
Last active December 1, 2016 08:34
Get Plugin-Data fromWordPress.org API
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<div class="wp_org_api"></div>
<script>
//setUp Post Data
var actionType = 'hot_tags';
var number = 10;
var timeout = 15;
//Parse Post Data
var postData = {
@anandthakker
anandthakker / index.js
Created March 7, 2015 02:24
Twitter search API test
// Usage: node index.js "twitter search string"
var request = require('request');
// Grab a bearer token using application-only auth
// (doc: https://dev.twitter.com/oauth/application-only)