Skip to content

Instantly share code, notes, and snippets.

View Celestz's full-sized avatar

Patrick Chua Celestz

  • Metro Manila
View GitHub Profile
@Celestz
Celestz / fibsimple.js
Last active December 12, 2023 09:32
Fib Straight forward
// 0 1 1 2 3 5 8 13 21 34
function fibValue(index) {
let [prev, next] = [0, 1]
if (index < 2) {
return index
}
for (var x = 2; x < index; x++) {
const result = prev + next
@Celestz
Celestz / script.js
Created April 23, 2018 08:18
Using jQuery Ajax with https://file.io
$(<file element name>).on('change',function(){
var filename = $('#uploadname').val()
var data = new FormData()
var thisElement = $(this)
$.each(thisElement[0].files, function(i, file) {
data.append('file', file)
})
$('.loadingOverlay').show() //TOTALLY OPTIONAL, Just an overlay element I call for the form.
$.ajax({
xhr: function(){ //TOTALLY OPTIONAL, I just needed this for the progress bar display, you can use it or not.
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
/*! https://mths.be/punycode v1.3.2 by @mathias */
;(function(root) {
/** Detect free variables */
var freeExports = typeof exports == 'object' && exports &&
!exports.nodeType && exports;
var freeModule = typeof module == 'object' && module &&
!module.nodeType && module;