Skip to content

Instantly share code, notes, and snippets.

@przemoc
przemoc / youtube-sort-videos-by-length.md
Last active March 29, 2025 10:24
Bookmarklet for YouTube: Sort videos by length in videos tab

Bookmarklet for YouTube: Sort videos by length in videos tab

On channels in videos tab you can sort videos by:

  • Most popular
  • Date added (oldest)
  • Date added (newest)

But you cannot sort by length. So I decided to create a bookmarklet to do it in ascending order.

@coralieco
coralieco / database_managenent_for_sql_queries.md
Last active November 21, 2018 14:22
ActiveRecord advanced query: What happens in DB with has_many & distinct queries

ActiveRecord advanced query

☀️ postgresql: has_many & distinct.

What happens in DB ?

Rails app

I created a rails app with models like so:

@coralieco
coralieco / pg_ar_in_ruby_project.md
Last active November 17, 2018 15:22
Use ActiveRecord and PG in Ruby project to play with data

Connect DB to a Ruby Project and play with queries in console

I already had a ruby project, and there are few things I wanted to try to test some ActiveRecord queries. First I implemented a small script (see here ) But it was not easy to play with classes as I had to run the full script (gem installs, models definitions etc.).

I was looking a way to interact directly with the dabase in console.

Models

@GCorbel
GCorbel / run
Last active June 16, 2017 13:16
This is an executable I use to simply the execution of commands inside a docker container
#!/usr/bin/ruby
require 'yaml'
require 'optparse'
options = {}
opt_parser = OptionParser.new do |opt|
opt.banner = 'Usage: run bash'
opt.separator ''
opt.separator 'Example:'
@mmrko
mmrko / git-zsh-checkout-autocomplete-local-only.md
Last active July 20, 2023 08:48
List only local branches when autocompleting git checkout (Zsh)
git config --global alias.checkoutr checkout
$EDITOR /usr/local/share/zsh/site-functions/git-completion.bash

...and then modify the file as follows...

-__gitcomp_nl "$(__git_refs '' $track)"
+if [ "$command" = "checkoutr" ]; then
+    __gitcomp_nl "$(__git_refs '' $track)"
+else
@Atlas7
Atlas7 / gist:d0c0680ae573a72e2d3d
Created January 13, 2016 17:20 — forked from mrcasals/gist:2788529
Rails: Reinstall postgreSQL via brew ang pg gem on Mac OS X
$ brew uninstall postgresql
$ gem uninstall pg # ALL OF THEM
$ rm -fr /usr/local/var/postgres
$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
$ pg_ctl -D /usr/local/var/postgres stop -s -m fast # WE SHOULD HAVE ALL postgres SERVERS & PROCESSES STOPPED BY NOW
$ brew install postgres
$ env ARCHFLAGS="-arch x86_64" gem install pg
$ echo "DONE." >> /dev/null
@0XDE57
0XDE57 / config.md
Last active March 7, 2025 05:54
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable. I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere No longer required: Enable HTTPS-Only Mode, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".