Skip to content

Instantly share code, notes, and snippets.

View gosukiwi's full-sized avatar

Federico Ramirez gosukiwi

View GitHub Profile
@gosukiwi
gosukiwi / common-lisp-cheatsheet.md
Last active April 16, 2024 13:59
Common Lisp Cheatsheet

Common Lisp Cheatsheet

Common Lisp is a general-purpose programming language with functions as first-class citizens. Don't worry about being purely functional, Lisp is Object Oriented too. CLOS is a very powerful object-oriented system!

Useful definitions

The Common Lisp lingo is quite unique:

  • Package: Basically a namespace, a place for symbols to live
  • System: Basically a Library. A bunch of code plus some instructions how it should be treated, for example which other systems it depends on, what should be loaded and/or compiled first, etc. Not in ANSI lisp but widespread. The most common system definition tool is ASDF.
  • Modules: Deprecated and implementation-dependent
  • Quicklisp: Like NPM or Ruby Gems for ASDF Systems.
@gosukiwi
gosukiwi / openSUSE-init.md
Last active April 13, 2024 18:52
Things to do after installing openSUSE
  1. Add packman packages
  2. Install Infinality
  3. Install "build essentials": sudo zypper in --type pattern devel_basis
  4. Install Linuxbrew (to install apps which might not be in zypper, or to install them in $HOME)
  5. Get Dropbox: sudo zypper in Dropbox && dropbox start -i
  6. Get Source Code Pro font
  7. Set "Source Code Pro" as default monospace font, "Roboto" as default sans-serif and "Droid Serif" as default serif.
  8. Configure gnome shell as login shell and set up base16
  9. Use numix theme with elementary icons or paper icons
  10. Set up development environment
@gosukiwi
gosukiwi / paginator.inc.php
Last active January 24, 2022 09:39
PHP Pagination generator
<?php
/**
* Pagination generator
*/
class Pagination
{
private $items_per_page = 0;
private $items_total = 0;
private $mid_range = 7;
private $page_name = 'page';
" Use |:RubocopAutocorrect[!]| to autocorrect the current file using Rubocop.
" Note that this will save the file before running the autocorrects. If ! is
" given, it will use unsafe autocorrects.
augroup ruby
autocmd!
autocmd FileType ruby command! -bang RubocopAutocorrect silent! call RubyRubocopAutocorrect(expand('<bang>') == '!')<CR>
augroup END
function! RubyRubocopAutocorrect(unsafe) abort
let flag = a:unsafe ? '-A' : '-a'
@gosukiwi
gosukiwi / powershell-bash.md
Last active July 4, 2020 17:01
Powershell <=> Bash

Commands

Popular bash commands in PowerShell:

grep: Select-String
  Select-String -r "console" .\foo\**\*.js
  
cat: Get-Content
  Get-Content foo.md
 
// VARIABLES
// no need to specify type
a = 1.2 // float
name = "Federico" // string
// you can still do it if you want
x as float
x = 1.2
function Double(x as integer)
@gosukiwi
gosukiwi / .vimrc
Last active February 24, 2020 06:01
.vimrc
" ---------------------- USABILITY CONFIGURATION ----------------------
" Basic and pretty much needed settings to provide a solid base for
" source code editting
" don't make vim compatible with vi
set nocompatible
" turn on syntax highlighting
syntax on
" and show line numbers
App.Lib.GlobalEvents =
###
This will trigger the callback whenever the user clicks on something outside
the given element. If the user clicks on something insied `el`, it will not
trigger the callback.
You can give it many elements using jQuery's `#add`:
$els = $('.my-element').add($('.some-other-element'))
App.Lib.GlobalEvents.onClickedOutside $els, =>
# do something
###

Caching

This can cache AJAX requests across page-loads with custom max-ages:

FIVE_MINUTES = 5 * 60 * 1000
App.Lib.Cache.promise().maxAge(FIVE_MINUTES).cache('/foo', -> $.get('/foo')).then (results) ->
  console.log results