Skip to content

Instantly share code, notes, and snippets.

View dapicester's full-sized avatar

Paolo D'Apice dapicester

View GitHub Profile
@dapicester
dapicester / application_system_test_case.rb
Created November 2, 2024 10:02
Instrument JavaScript code with Istanbul when running system tests on Rails 7 with importmaps
# test/application_system_test_case.rb
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
include IstanbulInstrumentation
instrument_dir "app/javascript/controllers"
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
@dapicester
dapicester / lualine.lua
Created November 9, 2023 10:00 — forked from Lamarcke/lualine.lua
Lualine config for LSP clients, formatters and linters
-- Returns a string with a list of attached LSP clients, including
-- formatters and linters from null-ls, nvim-lint and formatter.nvim
local function get_attached_clients()
local buf_clients = vim.lsp.get_active_clients({ bufnr = 0 })
if #buf_clients == 0 then
return "LSP Inactive"
end
local buf_ft = vim.bo.filetype
@dapicester
dapicester / orbit_swap.sh
Last active June 4, 2022 15:49
Swap mouse buttons for Orbit Wireless
#!/bin/bash
case $1 in
1|on|yes|true)
karabiner_cli --set-variables "{\"orbit_swap_buttons\":1}"
;;
0|off|no|false)
karabiner_cli --set-variables "{\"orbit_swap_buttons\":0}"
;;
*)
@dapicester
dapicester / howto.md
Last active August 4, 2019 06:10
ShadowSocksR linux

How to set up:

git clone --branch akkariiin/master https://github.com/shadowsocksrr/shadowsocksr.git
cd shadowsocksr
bash initcfg.sh

Edit the configurations:

$EDITOR user-config.json
@dapicester
dapicester / gist:19c0f0fc63b090d430fed6a15e2eaf52
Created July 29, 2019 14:18
Find raspberry pi on local network
arp -a | grep b8:27:eb
#!/bin/sh
# Adapted from bundled bin/dia script
CWD="/Applications/Dia.app/Contents/Resources/bin"
TOP="`dirname \"$CWD\"`"
export DISPLAY=:0
export LANG="en_US.UTF-8"
import React from 'react'
import { isEqual, template } from 'lodash'
// This is a DOM library, some plumbing with refs is required.
import 'json-editor'
// Get the imported reference from the global namespace.
const JSONEditor = window.JSONEditor
// Set sensible defaults
@dapicester
dapicester / .projections.json
Last active August 7, 2017 07:40
Projections for Django projects
{
"*/apps.py": {
"type": "app"
},
"*/urls.py": {
"type": "urls"
},
"*/utils.py": {
require 'arduino_firmata'
ArduinoFirmata.connect ARGV.shift, bps: 9600 do
puts "firmata version #{version}"
reset # This line did the trick!
puts "led on ..."
digital_write 13, true
sleep 1
@dapicester
dapicester / store_page_on_session
Created June 14, 2016 09:43 — forked from CootCraig/store_page_on_session
storing page on session for will_paginate
class ApplicationController < ActionController::Base
...
before_filter :page_params, :only => :index
def page_key
(self.class.to_s + "_page").to_sym
end
# Use a before_filter on index action to remember the current page