Skip to content

Instantly share code, notes, and snippets.

View beta.js
let alreadyRun = document.querySelector('body').classList.contains("vl-bookmarklet");
let domainCheck = window.location.origin == "http://legaldiary.courts.ie"
function wrap(el, wrapper) {
el.parentNode.insertBefore(wrapper, el);
wrapper.appendChild(el);
}
function addStyle(styleString) {
const style = document.createElement('style');
@jcsrb
jcsrb / authorization.md
Created Jun 19, 2018 — forked from nikneroz/authorization.ex
Elixir + Phoenix Framework 1.3 + Guardian 1.0 + JWT(Refresh, Revoke, Recover) + Comeonin
View authorization.md

Elixir + Phoenix Framework 1.3 + Guardian + JWT(Refresh, Revoke, Recover) + Comeonin

User model bootstrap

Let's generate User model and controller.

mix ecto.create # create DB table
mix phx.gen.json Accounts User users email:string password_hash:string # scaffold users structure
@jcsrb
jcsrb / extract.rb
Created Mar 7, 2018
Dig in hashes or arrays
View extract.rb
def extract_stuff(stuff, path)
path.empty? stuff : extract_stuff(stuff[path.shift], path)
end
@jcsrb
jcsrb / map-values-async.js
Created Jan 28, 2018
Lodash's .mapValues but for async functions
View map-values-async.js
const mapValuesAsync = (obj, asyncFn) => {
const keys = Object.keys(obj);
const promises = keys.map(k => {
return asyncFn(obj[k]).then(newValue => {
return {key: k, value: newValue};
});
});
return Promise.all(promises).then(values => {
const newObj = {};
values.forEach(v => {
View gist:a326660e3a8b3ddb5ded39fea9b5ace8
### Keybase proof
I hereby claim:
* I am jcsrb on github.
* I am jcsrb (https://keybase.io/jcsrb) on keybase.
* I have a public key ASAPauepdarl-YvGUpS_RF7U_p6RxbLQ5f7splmcXzQnaQo
To claim this, I am signing this object:
@jcsrb
jcsrb / a2dp.py
Created Mar 27, 2017 — forked from pylover/a2dp.py
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
View a2dp.py
#! /usr/bin/env python3.5
"""
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04 and also debian jessie, with bluez5.
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone.
This will be only fixes the bluez5 problem mentioned above .
View keybase.md

Keybase proof

I hereby claim:

  • I am jcsrb on github.
  • I am jcsrb (https://keybase.io/jcsrb) on keybase.
  • I have a public key ASCcxeaPZDsY8ETLqzw4mxAFz2nD6WD0lxGjm0avOP2_RQo

To claim this, I am signing this object:

@jcsrb
jcsrb / Install Ruby and RubyGems
Last active Jan 12, 2018 — forked from chiraggude/Install Ruby and RubyGems
Install Ruby 2.2.1 and RubyGems 2.4.8 on CentOS 6.5
View Install Ruby and RubyGems
# Install Ruby
wget http://ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.1.tar.gz
tar xvzf ruby-2.2.1.tar.gz
cd ruby-2.2.1
./configure --prefix=/usr
make
make install
# remove "ruby-2.1.1" folder in /root
View a.html
<html style="margin:0">
<body style="margin:0">
<img src='http://i.imgur.com/QwA1fvX.png' width='100%'>
</body>
</html>
@jcsrb
jcsrb / install-squid.sh
Created Aug 29, 2016 — forked from cdodd/install-squid.sh
Install a basic squid proxy with authentication on Centos 6 x64. Just modify the variables at the top and run the script on a clean system.
View install-squid.sh
#!/bin/sh
PROXY_USER=user
PROXY_PASS=password
PROXY_PORT=3128
# Clear the repository index caches
yum clean all
# Update the operating system