Skip to content

Instantly share code, notes, and snippets.

Avatar
🦄
Jumping over Rainbows...

Theofanis Despoudis theodesp

🦄
Jumping over Rainbows...
View GitHub Profile
@theodesp
theodesp / imgpreload.js
Last active Aug 29, 2015
A simple Javascript image preloader
View imgpreload.js
/* Image Preloader
* imgpreload.js
*
* A simple Javascript image preloader
* Created by Theo Despoudis
* (c) 2014 Theo Despoudis. MIT open-source license.
*/
; // Debloat
(function () {
@theodesp
theodesp / scriptloader.js
Created Jun 3, 2014
Simple Script Loader
View scriptloader.js
/* Script loader
* scriptloader.js
*
* A simple Javascript script loader
* Created by Theo Despoudis
* (c) 2014 Theo Despoudis. MIT open-source license.
*/
function loadScript(url, callback) {
@theodesp
theodesp / list.js
Created Jun 8, 2014
List Data Structure
View list.js
function List() {
this.listSize = 0;
this.pos = 0;
this.dataStore = []; // initializes an empty array to store list elements
this.clear = clear;
this.find = find;
this.toString = toString;
this.insert = insert;
this.append = append;
this.remove = remove;
@theodesp
theodesp / init.lua
Created Nov 30, 2016
My Hammerspoon configuration
View init.lua
-- Configuration reloader
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end
if doReload then
hs.reload()
View keybase.md

Keybase proof

I hereby claim:

  • I am theodesp on github.
  • I am thdespou (https://keybase.io/thdespou) on keybase.
  • I have a public key ASCOxYSHkPXOv7SXou594vZHvAVzj8Lvdwcmpe-36UxOrAo

To claim this, I am signing this object:

@theodesp
theodesp / basic-R6RS.scm
Created Aug 22, 2018
Basic R6RS scheme template #scheme
View basic-R6RS.scm
(import (rnrs (6)))
(use-modules ((rnrs) :version (6)))
@theodesp
theodesp / aliases.scm
Last active Aug 22, 2018
Scheme Reference #scheme
View aliases.scm
(import (rnrs (6)))
(use-modules ((rnrs) :version (6)))
;; Make a variable `call/cc' an alias of `call-with-current-continuation`.
(define call/cc call-with-current-continuation)
@theodesp
theodesp / range.scm
Last active Aug 22, 2018
Range of numbers #scheme
View range.scm
(import (rnrs (6)))
(use-modules ((rnrs) :version (6)))
(define (range from to step)
"" Range from to using step
(if (>= from to)
'()
(cons from (range (+ from step) to step))))
@theodesp
theodesp / safe-first.scm
Last active Aug 22, 2018
Safe first #scheme
View safe-first.scm
(import (rnrs (6)))
(use-modules ((rnrs) :version (6)))
(define (safe-first sent)
;; Return first if not empty
(if (empty? sent)
'()
(first sent)))
@theodesp
theodesp / sign.scm
Last active Aug 23, 2018
Get sign of Number #scheme
View sign.scm
(import (rnrs (6)))
(use-modules ((rnrs) :version (6)))
(define (sign number)
(cond
((< number 0) 'negative)
((= number 0) 'zero)
(else 'positive))
)