Skip to content

Instantly share code, notes, and snippets.

View crivotz's full-sized avatar
🏠
Working from home

Mauro Locatelli crivotz

🏠
Working from home
View GitHub Profile
@crivotz
crivotz / makerequest.js
Created January 8, 2019 15:00
Request with XMLHttpRequest and promises
function makeRequest(opts) {
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open(opts.method, opts.url);
xhr.withCredentials = true;
xhr.onload = function() {
if (this.status >= 200 && this.status < 300) {
resolve(xhr.response);
} else {
reject({
@crivotz
crivotz / rails_dirty.md
Last active November 15, 2021 11:09
Rails dirty prameters

Rails dirty

After modifying an object and after saving to the database, or within after_save:

Rails <= 5 Rails >= 5.1
attribute_changed? saved_change_to_attribute?
changed? saved_changes?
changes saved_changes
attribute_was attribute_before_last_save
sudo apt-get install -y \
git \
g++ \
libgtk-3-dev \
gtk-doc-tools \
gnutls-bin \
valac \
intltool \
libtool \
libpcre2-dev \
@crivotz
crivotz / vim_installation.md
Last active August 4, 2023 12:53
Vim installation

Clean from standard vim

sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common

Vim dependency

sudo apt-get install liblua5.4-dev luajit2 libluajit2-5.1-2 python3.11-dev libperl-dev python3 libncurses5-dev

Clean and prepare folders

@crivotz
crivotz / .remap_caps_lock.sh
Created August 3, 2015 14:45
Launcher for xmodmap
#!/bin/sh
xmodmap ~/.Xmodmap
@crivotz
crivotz / .Xmodmap
Created August 3, 2015 14:44
Change Caps_lock into Control left
!Turn Caps Lock into another Control key
keycode 66 = Control_L
clear Lock
add Control = Control_L
@crivotz
crivotz / themes.cfg
Created August 3, 2015 10:47
Aretes Theme.cfg for fluxbox
style.name: Aretes
style.author: Mauro Locatelli
style.date: August 3, 2015
style.credits:
style.comment:
toolbar: flat
toolbar.pixmap: toolbar.xpm
toolbar.textColor: #c0c0c0
toolbar.justify: center
@crivotz
crivotz / .conkyrc
Last active August 29, 2015 14:26
Aretes Conky theme .conkyrc (two monitors)
#avoid flicker
double_buffer yes
#own window to run simultanious 2 or more conkys
own_window yes
own_window_transparent no
own_window_type panel
own_window_hints undecorate,sticky,skip_taskbar,skip_pager
#borders
@crivotz
crivotz / xorg.conf
Created August 3, 2015 10:43
Xorg.conf for dual monitor
Section "ServerLayout"
Identifier "aticonfig Layout"
Screen 0 "aticonfig-Screen[0]-0" 0 0
Screen "aticonfig-Screen[0]-1" RightOf "aticonfig-Screen[0]-0"
EndSection
Section "Module"
EndSection
Section "ServerFlags"
/* Panel */
#cookieChoiceInfo {
background-color: #6a7ed5; /* Panel background color */
border-top: 4px solid #c8b13c; /* Border top color and type */
color: #FFFFFF; /* Font color */
padding: 10px;
opacity: .8; /* Opacity */
}
/*More info link*/