Skip to content

Instantly share code, notes, and snippets.

View nietaki's full-sized avatar
😌
purposeful

Jacek Królikowski nietaki

😌
purposeful
View GitHub Profile
@pyzlnar
pyzlnar / ecto_iex_helpers.ex
Last active September 18, 2023 18:30
A few Ecto helpers that you might want to add to your .iex.exs file. Were created with PSQL in mind
import_if_available(Ecto.Query)
# alias MyApp.Repo
defmodule R do
# Old habits die hard. Take a random of something. You don't care which.
# > R.take(SomeSchema)
def take(schema_or_query) do
schema_or_query
|> limit(1)
|> Repo.one()
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
// Processing code by Etienne JACOB
// motion blur template by beesandbombs
// opensimplexnoise code in another tab might be necessary
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e
int[][] result;
float t, c;
float ease(float p) {

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
@lucasdavila
lucasdavila / fixup.txt
Last active December 20, 2023 12:00
Fixing mac os yosemite issue "bash: fork: Resource temporarily unavailable"
# see the current limits
$ sysctl -a | grep maxproc
# increase it
$ sudo sysctl -w kern.maxproc=xxxx
$ sudo sysctl -w kern.maxprocperuid=xxx
# run at startup
$ sudo vim /etc/sysctl.conf
@pyetras
pyetras / 0bootstrap.sh
Last active September 13, 2016 22:00
OS X dotfiles
#AppStore: Install XCode
#install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
curl https://gist.githubusercontent.com/pyetras/4b59e1902cfaf9af3c98/raw/Caskfile > Caskfile
curl https://gist.githubusercontent.com/pyetras/4b59e1902cfaf9af3c98/raw/Brewfile > Brewfile
@larroy
larroy / BinarySearch.scala
Last active January 8, 2017 06:56
Binary search in scala
import scala.annotation.tailrec
object BinarySearch {
/**
* @param xs Sequence to search
* @param key key to find
* @param min minimum index (inclusive)
* @param max maximum index (inclusive)
* @param keyExtract function to apply to elements xs before comparing to key, defaults as identity
* @tparam T type of elements in the sequence
@lshoo
lshoo / gist:9785645
Created March 26, 2014 15:13
Slick2 generic dao
package slicks.docs.dao
import scala.slick.driver.PostgresDriver.simple._
import scala.slick.driver._
trait Profile {
val profile: JdbcProfile
}
@phaedryx
phaedryx / summary
Last active December 3, 2022 19:27
Loyalty and Layoffs by David Brady
Original text here: https://whydavewhy.com/2013/08/16/loyalty-and-layoffs/
@dciccale
dciccale / README.md
Last active May 22, 2018 09:14
Cross-browser triggerEvent function done with 127 bytes of JavaScript

triggerEvent

Cross-browser function to trigger DOM events.