Skip to content

Instantly share code, notes, and snippets.

View alexshenia's full-sized avatar

Alex Shenia alexshenia

View GitHub Profile
@alexshenia
alexshenia / waitForKeyElements.js
Created July 23, 2024 15:09 — forked from BrockA/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@alexshenia
alexshenia / gist:b0558f745c353c125c0b5dbc50e2f094
Created May 3, 2017 04:59 — forked from jmickela/gist:7c383c78af66a37a2446fe7eb733b157
Trying to get PhpStorm to use git in Bash on Ubuntu on Windows (Windows Subsystem for Linux)
There's a problem that you run into right away: you can't put a command line command, with arguments,
into the path to git executable box.
So putting something like bash.exe -c "git %*" isn't going to work. I wrote a small shell script that
fixes this, for both 32-bit and 64-bit systems.
@echo off
If %PROCESSOR_ARCHITECTURE% == x86 (
"C:\Windows\sysnative\bash.exe" -c "git %*"
) Else (
@alexshenia
alexshenia / file.js
Created July 26, 2016 09:04
Run in JS
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+
@alexshenia
alexshenia / site.conf
Created November 29, 2015 12:45 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
CREATE USER 'USER'@'localhost' IDENTIFIED BY 'PWD';
GRANT USAGE ON *.* TO 'USER'@'localhost' IDENTIFIED BY 'PWD' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
CREATE DATABASE IF NOT EXISTS `DATABASE`;
GRANT ALL PRIVILEGES ON `DATABASE`.* TO 'USER'@'localhost';
@alexshenia
alexshenia / file.java
Created September 23, 2015 15:22
file.java
public List<BOProduct> interrelatedProductList() {
List<BOProduct> list = new ArrayList<BOProduct>();
BOProduct product = inheritInterrelatedProducts() ? parentRelationship().parent() : this;
for (BOInterrelatedProduct interrelatedProduct : interrelatedProductRelationList()) {
if (interrelatedProduct.product1() == null) {
continue;
}
if (interrelatedProduct.product1().primaryKey() == null) {
// the list may contain not yet saved products
# https://gist.github.com/rilian/e89d9dbc096f56ebcb1d
#
# Custom rspec matcher for testing CanCan abilities.
# Originally inspired by https://github.com/ryanb/cancan/wiki/Testing-Abilities
#
# Usage:
# expect.to have_abilities(:create).on(Post.new)
# expect.to have_abilities([:read, :update].on(post)
# expect.to have_abilities({manage: false, destroy: true}.on(post)
# expect.to have_abilities({create: false}.on(Post.new)

TL;DR

sudo pg_dropcluster 9.4 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main