Skip to content

Instantly share code, notes, and snippets.

View theodesp's full-sized avatar
🦄
Jumping over Rainbows...

Theofanis Despoudis theodesp

🦄
Jumping over Rainbows...
View GitHub Profile
@theodesp
theodesp / imgpreload.js
Last active August 29, 2015 14:01
A simple Javascript image preloader
/* 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 June 3, 2014 19:49
Simple Script Loader
/* 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 June 8, 2014 19:54
List Data Structure
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 November 30, 2016 14:51
My Hammerspoon configuration
-- 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()

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 August 22, 2018 09:10
Basic R6RS scheme template #scheme
(import (rnrs (6)))
(use-modules ((rnrs) :version (6)))
@theodesp
theodesp / aliases.scm
Last active August 22, 2018 11:35
Scheme Reference #scheme
(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 August 22, 2018 12:27
Range of numbers #scheme
(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 / main.scm
Created August 22, 2018 11:37
Simple main executable scheme #scheme
#!/usr/local/bin/guile \
-e main -s
!#
(define (main args)
;; Usage ./main.scm a b c
(map (lambda (arg) (display arg) (display " "))
(cdr args))
(newline))
@theodesp
theodesp / safe-first.scm
Last active August 22, 2018 14:01
Safe first #scheme
(import (rnrs (6)))
(use-modules ((rnrs) :version (6)))
(define (safe-first sent)
;; Return first if not empty
(if (empty? sent)
'()
(first sent)))