Skip to content

Instantly share code, notes, and snippets.

View mpaccione's full-sized avatar
🎯
Focusing

Michael Paccione mpaccione

🎯
Focusing
View GitHub Profile
@mpaccione
mpaccione / server.js
Created February 19, 2016 22:38
FileServer
// Read to end first, then solve one by one.
var express = require('express');
// #0. Load 'multer' here.
var mul = require('multer');
// #1. Use folder 'uploads' for multer's upload here.
var storage = mul.diskStorage({
destination: function(req, file, cb){
$("#countdown").countdown("2016/08/01 12:34:56").on('update.countdown', function(event) {
var d = '%D days',
h = '%H hours',
m = '%M minutes',
s = '%S seconds';
if(event.offset.days > 0) { d = '%-d day%!d'; }
if(event.offset.hours > 0) { h = '%-h hour%!h'; }
if(event.offset.minutes > 0) { m = '%-m minute%!m'; }
function ajax_load_back() {
$post_id = $_POST[ 'post_id' ];
$the_post = get_post( $post_id, OBJECT);
$title = get_the_title($post_id);
$post = $the_post->post_content;
$text_content = preg_replace('/<img[^>]+./','', $post);
// $attachments = get_posts(
// array( 'post_type' => 'attachment',
// 'numberposts' => -1,
<?php
function quote_func($atts, $content = null){
$quote_attrs = shortcode_atts( array(
'logo' => 'Client Logo',
), $atts, 'quote' );
$output = "<div class='quote'><p class='text'>".$content."</p><div class='logo'>".wp_kses_post($quote_attrs["logo"])."</div></div>";
fetch("https://www.mystrainconnect.com:8081/getAllUsers",
{
method: "GET",
headers: {
'Content-Type': 'application/json'
}
}).then(res => res.json())
.catch(error => console.error('Error:', error))
.then(response => {
console.log('Success:', response);
// ENQUEUE FILES
add_action('wp_enqueue_scripts', 'enqueue_func');
function enqueue_func() {
wp_register_style( 'styles', get_template_directory_uri().'/css/styles.css' );
wp_register_style( 'bootstrapAndStyles', get_template_directory_uri().'/css/assets.css' );
wp_enqueue_script( 'jquery' );
wp_register_script( 'archive-script', get_template_directory_uri().'/js/index.js', array("jquery"), null, true );
wp_enqueue_script( 'archive-script' );
}
@mpaccione
mpaccione / gist:371a42694270e71d1ed371a72cfa7aaa
Created June 20, 2019 00:00
Trigonometry Helicopter Physics
updateVelocities(){
// Convert Degrees to Radians
const rollRads = this.roll < 0 ? this.getRadians( 150-this.roll ) : this.getRadians( 150+this.roll ) , // Hypothetically 90-this.roll, changed for better playability
pitchRads = this.pitch < 0 ? this.getRadians( 150-this.pitch ) : this.getRadians( 150+this.pitch ), // Hypothetically 90-this.pitch, changed for better playability
gravSimY = this.aY/this.weight,
yawRatio = this.yaw/this.maxYaw;
// Rotational Velocity
this.vR = this.aX * yawRatio;
@mpaccione
mpaccione / index.js
Created July 30, 2019 04:35
CRON Server
// Modules
const cors = require('cors'),
cron = require('node-cron'),
express = require('express'),
expressStaticGzip = require("express-static-gzip"),
path = require('path'),
request = require('request'),
THREE = require('three'),
app = express(),
// Globals
@mpaccione
mpaccione / gist:4a37558b0a89595897a82d794498fe51
Created July 31, 2019 18:16
Three.js Helicopter Collision Raycaster Issue
MAIN HELICOPTER CLASS
//////////////////////////////
/////////////////////////////
collisionDetection(){
console.log("collisionDetection()");
const obj = {
rayCasters: this.rayCasters,
collidableMeshList: window.collidableMeshList
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.