Skip to content

Instantly share code, notes, and snippets.

View aL3xa's full-sized avatar

Aleksandar Blagotić aL3xa

View GitHub Profile
@staltz
staltz / introrx.md
Last active May 2, 2024 12:31
The introduction to Reactive Programming you've been missing
@nicdaCosta
nicdaCosta / Grep.js
Last active March 9, 2024 13:39
Basic function that searches / filters any object or function and returns matched properties.
/*
Grep.js
Author : Nic da Costa ( @nic_daCosta )
Created : 2012/11/14
Version : 0.2
(c) Nic da Costa
License : MIT, GPL licenses
Overview:
Basic function that searches / filters any object or function and returns matched properties.
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@dAnjou
dAnjou / _.md
Last active November 14, 2023 11:49
Automatically unlock KeePass database with GNOME Keyring

(Tested with KeePassXC on Fedora 25)

By default when using GNOME Keyring you have a keyring that is unlocked when you log in (usually called "Login"). You can make use of that by storing a KeePass database password in this keyring and using it to automatically unlock your KeePass database.

Store the KeePass database password in GNOME Keyring. You'll have to set a label and at least one attribute/value pair. The label is displayed in a GNOME keyring manager (e.g. Seahorse), the attribute/value pair should be a unique identifier because it's needed for the lookup. I suggest to use keepass as attribute and the database name as value (make sure it doesn't contain any spaces).

secret-tool store --label="KeePass <database_name>" keepass <database_name>

Then create a script to launch and immediately unlock your KeePass database.

@umpirsky
umpirsky / userContent.css
Last active November 2, 2023 17:19
Firefox dark theme workaround (https://bugzilla.mozilla.org/show_bug.cgi?id=519763) Inspired by https://wiki.archlinux.org/index.php/Firefox#Unreadable_input_fields_with_dark_GTK.2B_themes. Add it to ~/.mozilla/firefox/xxxxxxxx.default/chrome/userContent.css or using https://addons.mozilla.org/en-US/firefox/addon/stylish/ add-on. add-on.
input:not(.tactile-searchbox-input):not(.urlbar-input):not(.textbox-input):not(.form-control):not([type='checkbox']) {
-moz-appearance: none !important;
background-color: white;
color: black;
}
#downloads-indicator-counter {
color: white;
}
@swyxio
swyxio / createCtx-noNullCheck.tsx
Last active May 4, 2023 02:15
better createContext APIs with setters, and no default values, in Typescript. this is documented in https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/blob/master/README.md#context
// create context with no upfront defaultValue
// without having to do undefined check all the time
function createCtx<A>() {
const ctx = React.createContext<A | undefined>(undefined)
function useCtx() {
const c = React.useContext(ctx)
if (!c) throw new Error("useCtx must be inside a Provider with a value")
return c
}
return [useCtx, ctx.Provider] as const
@ybart
ybart / gist:1070803
Created July 7, 2011 23:42
Google +1 Bookmarklet (Bottom Right)
javascript:(function(){div=document.createElement('div');e=document.createElement('g:plusone');div.style.position='fixed';div.style.bottom='8px';div.style.right='8px';div.appendChild(e);document.body.appendChild(div);e=window.document.createElement('script');e.setAttribute('src','https://apis.google.com/js/plusone.js');document.body.appendChild(e);})();
@fajrif
fajrif / rvm_cheatsheet
Created June 14, 2011 14:11
RVM cheatsheet
RVM home page: http://rvm.beginrescueend.com
Install RVM
------------
See http://rvm.beginrescueend.com/rvm/install/
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Install rvm for all users
@paulrouget
paulrouget / scratchpad.js
Created November 2, 2012 17:59
Floating scrollbars in Firefox
/**
* How to have floating scrollbars in Firefox (Linux, Windows & Mac).
* Screenshot: http://i.imgur.com/bn44L.png
* You need Firefox > 18. Just run this code in a browser-scratchpad:
*
* Ping me on Twitter (@paulrouget) if you run into problems.
*
* 1. Go to about:config - Set devtools.chrome.enabled to true
* 2. Starts Scratchpad (Shift-F4)
* 3. In Scratchpad's menubar, check "Environment > Browser"
@jaspervdj
jaspervdj / volume.rb
Created February 7, 2011 16:17
Set pulseaudio volume from the command line
#!/usr/bin/ruby
# Pulseaudio volume control
class Pulse
attr_reader :volumes, :mutes
# Constructor
def initialize
dump = `pacmd dump`.lines
@volumes = {}