Skip to content

Instantly share code, notes, and snippets.

@ditzel
ditzel / KdTree.cs
Last active August 27, 2024 06:18
k-d Tree
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
public class KdTree<T> : IEnumerable<T>, IEnumerable where T : Component
{
protected KdNode _root;
protected KdNode _last;
@arcanoix
arcanoix / index.html
Created October 27, 2017 17:59
VueJS Personality Quiz
<div id="app" v-cloak>
<div class="row">
<div class="large-12 columns">
<h1>{{ quiz.title }}</h1>
<div class="callout">
<div v-for="(question, index) in quiz.questions">
<!-- Hide all questions, show only the one with index === to current question index -->
@GoToLoop
GoToLoop / resizeNN.js
Last active June 6, 2023 18:11 — forked from gncgnc/resizeNN.js
Extends p5.Image to handle nearest neighbor resizing for scaling images w/o blurring.
/**
* Resize the image to a new width and height using nearest neighbor algorithm.
* To make the image scale proportionally,
* use 0 as the value for the wide or high parameters.
* For instance, to make the width of an image 150 pixels,
* and change the height using the same proportion, use resize(150, 0).
* Otherwise same usage as the regular resize().
*
* Note: Disproportionate resizing squashes "pixels" from squares to rectangles.
* This works about 10 times slower than the regular resize.
@gncgnc
gncgnc / resizeNN.js
Last active June 7, 2023 01:52
Extends p5.Image to handle nearest neighbor resizing for scaling small images (e.g. pixel art) without blurring. You can also make regular images into pixelated images by shrinking then growing them with this method (a la MS Paint.)
/**
* Resize the image to a new width and height using nearest neigbor algorithm. To make the image scale
* proportionally, use 0 as the value for the wide or high parameter.
* For instance, to make the width of an image 150 pixels, and change
* the height using the same proportion, use resize(150, 0).
* Otherwise same usage as the regular resize().
*
* Note: Disproportionate resizing squashes the "pixels" from squares to rectangles.
* This works about 10 times slower than the regular resize. Any suggestions for performance increase are welcome.
*/
@xmon
xmon / lg-editartgroup.js
Created December 21, 2016 20:56
Custom plugin for sachinchoolur/lightGallery
(function () {
'use strict';
var defaults = {
editArtGroup: true
};
var EditArtGroup = function (element) {
@mjvo
mjvo / Input2p5js.ino
Last active March 7, 2019 12:13
Serial Input to P5.js - Arduino and p5js code
void setup() {
Serial.begin(9600); // initialize serial communications @ 9600
}
void loop() {
int potentiometer = analogRead(A0); // read the input pin
int mappedPot = map(potentiometer, 0, 1023, 0, 255); // remap the pot value to fit in 1 byte
//Serial.write(mappedPot); // write mappedPot value to the serial port (1 byte)
Serial.println(potentiometer); // *or* use println to print out raw potentiometer value with newline as data separator
delay(1); // slight delay to stabilize the ADC
@yjiro0403
yjiro0403 / UnityandKinectV2_ColoredPointCloud.cs
Created June 27, 2016 03:02
Unity And Kinect V2 Point Cloud
using UnityEngine;
using Windows.Kinect;
//fileIO
using System.IO;
public class ColoredParticle2 : MonoBehaviour {
public GameObject MultiSourceManager;
public Color color = Color.green;
@swapnilshrikhande
swapnilshrikhande / function.php
Created April 26, 2016 10:08 — forked from YugalXD/function.php
Send mail with mailgun api by PHP CURL.
<?php
define('MAILGUN_URL', 'https://api.mailgun.net/v3/DOMAIN_NAME');
define('MAILGUN_KEY', 'KEY');
function sendmailbymailgun($to,$toname,$mailfromnane,$mailfrom,$subject,$html,$text,$tag,$replyto){
$array_data = array(
'from'=> $mailfromname .'<'.$mailfrom.'>',
'to'=>$toname.'<'.$to.'>',
'subject'=>$subject,
'html'=>$html,
@AleeRojas
AleeRojas / ajax-modal.js
Created February 18, 2016 16:21
Ajax y Modal Semantic-UI
$('body').on('click', '.ajax-modal', function() {
$('.ui.modal')
.modal({
onShow: function(callback) {
callback = $.isFunction(callback) ? callback : function(){};
var $content = $(this).find('.content');
$.get("contentData.php", function(data) {
$content.html(data);
});
}
@Committing
Committing / .hgignore
Last active May 6, 2023 02:07
.hgignore specifically for Wordpress
# Compiled by Jack (Committing)
# https://gist.github.com/Committing/7bd55ff4615248b7cea0
# GIT version: https://gist.github.com/Committing/24700559b3c05bdd2e3921c12c16f134
#################################
## Target root files/folders
#################################
syntax: regexp