Skip to content

Instantly share code, notes, and snippets.

@jnvsor
jnvsor / README.md
Last active February 16, 2023 02:12
A query to get workshop based scores for players in https://distance-db-sql.seekr.pw similar to holdboost and/or rocks

This query has been superceded by HoldGrip

@jnvsor
jnvsor / gist:32890993d63615bbd8a6cde9f31c9dbe
Created May 10, 2018 08:14
git publish - a history-less push for github pages
git config alias.publish '! git push -f origin $(git commit-tree HEAD^{tree} -m "Squash"):master'
@jnvsor
jnvsor / .bash_profile
Created June 22, 2017 20:20
.bash_profile for working ssh-add on windows
#!/bin/bash
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
}
@jnvsor
jnvsor / app.php
Last active May 20, 2017 22:29
Consistent symfony behaviour with apache rewrites
<?php
use Symfony\Component\HttpFoundation\Request;
$loader = require __DIR__.'/../app/autoload.php';
class RewriteRequest extends Request
{
protected $baseUrlFixed = null;
git config alias.commit-reset '!f() { target="$1"; shift; git merge $(git commit-tree "$target^{tree}" -p HEAD -m "$*"); }; f'
@jnvsor
jnvsor / Template.php
Last active February 21, 2017 21:58
Templating in PHP with extends in 25 lines
<?php
class Template {
private $extends = null;
private $template_dir;
private $args;
private $template;
public function __construct($template_dir)
{
@jnvsor
jnvsor / template.php
Last active February 21, 2017 18:53
Templating in PHP in 5 lines
<?php
function template(string $template_75NKTrkhX8ZWDF9R, array $args_75NKTrkhX8ZWDF9R = [])
{
extract($args_75NKTrkhX8ZWDF9R, EXTR_SKIP);
ob_start();
include TEMPLATE_DIR.$template_75NKTrkhX8ZWDF9R;
return ob_get_clean();
}
@jnvsor
jnvsor / ConnectionForFunAndProfit.php
Last active February 10, 2017 19:03
Extending DBAL for fun and profit
<?php
class ConnectionForFunAndProfit extends \Doctrine\DBAL\Connection
{
/**
* Wraps Connection::connect to prevent credentials leakage
* @return bool
*/
public function connect()
{
@jnvsor
jnvsor / gist:abba8f3b3b776f7c8d20
Created August 28, 2015 20:11
Bookmarklet to bypass annoying "Sign in to confirm your age" stuff on youtube
javascript:window.location="http://youtube.com/embed/"+document.location.href.match(/(\?|&)v=([^&]+)/)[2]