Skip to content

Instantly share code, notes, and snippets.

View bigos's full-sized avatar

Jacek Podkanski bigos

  • North West England
View GitHub Profile
@bigos
bigos / puzzle
Created September 29, 2014 18:48
Question: How to optimise Lisp
(defun expotential-divisors (n expot)
(reverse (loop
for y from 1 upto n
for x = 1 then (* x expot )
collect x)))
(defun expot-len (n)
(1- (expt 2 n)))
(defun calc-base (n divs a b)
;;;
(setq prelude-guru nil)
(global-hl-line-mode -1)
;(setq prelude-whitespace nil)
(setq prelude-flyspell nil)
;(smartparens-global-mode -1)
(global-linum-mode )
(require 'git-auto-commit-mode)
// fix autocomplete
/*
* Unobtrusive autocomplete
*
* To use it, you just have to include the HTML attribute autocomplete
* with the autocomplete URL as the value
*
* Example:
@bigos
bigos / colours.html
Last active April 16, 2016 00:12
colour suggestions for slime-presentations.el
<html>
<head>
<title>Colour selection</title>
<style>
.grey{color:#777;}
.red{color:red;}
.yellow{color: yellow;}
.orange-red{color: #ff4500;}
.tomato{color: #ff6347;}
.light-coral{color: #f08080;}
@bigos
bigos / _reader-macros.md
Created November 26, 2016 23:49 — forked from chaitanyagupta/_reader-macros.md
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@bigos
bigos / gist:adf886bc8c8241e1c48d2455e53f3a7a
Created December 18, 2016 23:39
Emacs Lisp function for unfolding lisp code
;; you can use this function to unfold s-exps so that newline follows after one or more closing brackets
(defun unfold-lisp ()
"Unfold lisp code."
(interactive)
(search-forward ")")
(backward-char)
(search-forward " ")
(newline-and-indent))
(global-set-key (kbd "s-0") 'unfold-lisp)
@bigos
bigos / excercise-1_9.lisp
Created December 18, 2016 23:55
Unfolded lisp code
(defun max-int (a)
(cond ((null a)
(error "empty list"))
((null (cdr a))
(car a))
(T
(max (car a)
(max-int (cdr a))))))
@bigos
bigos / importer-sample.rb
Created March 3, 2017 16:40
Sample of my Ruby code written 2 years ago
require 'csv'
# helper code for importing csv orders
class ReceiptImporter
attr_reader :found_errors, :invalid_receipts, :skipped_receipts, :imported_receipts, :total_receipts
def initialize(filepath, mode)
@depot = Depot.find Depot.current
@mode = mode
@record_types = { 'FH' => :file_header,
'RH' => :receipt_header,
@bigos
bigos / haskell-environment.org
Last active December 3, 2017 00:42
Environment used for experimenting with Haskell

Haskell installation experiment

download core Haskell platform

https://www.haskell.org/platform/

Install it to a destination folder without spaces

update mingw64 terminal

pacman -Syu, then kill the terminal when prompted restart it and resume update with pacman -Su

install required packages

pacman -S mingw64/mingw-w64-x86_64-pkg-config mingw64/mingw-w64-x86_64-clutter mingw64/mingw-w64-x86_64-gobject-introspection
@bigos
bigos / new-haskell-gi-example.org
Last active December 3, 2017 05:08
Description of Haskell installation and configuration on Windows 10

New attempt

instaled new test VM

updated the language and found that Power shell responds to

choco version
Chocolatey v0.10.8

installed MSYS2

Used Admin cmd

Missing Instructions