Skip to content

Instantly share code, notes, and snippets.

View neoascetic's full-sized avatar
🏖️
Sabbatical

Pavel neoascetic

🏖️
Sabbatical
View GitHub Profile
@neoascetic
neoascetic / multiline.bash
Created February 28, 2024 10:15
Neat way to define multiline variables in bash
#!/bin/bash
multiline() {
read -r -d '' "$@"
}
multiline text << 'END'
Hello, world!
Multiline docstrings seems to work today...
@neoascetic
neoascetic / teapot.svg
Last active February 1, 2024 19:51
Utah teapot as SVG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@neoascetic
neoascetic / patrons.py
Created January 29, 2023 07:41
Get patron emails from Patreon
import json
import requests
API_TOKEN = 'XXX'
CAMPAIGN_ID = 'XXX'
def get_page(url, headers):
result = requests.get(url, headers=headers)
@neoascetic
neoascetic / test.html
Created February 21, 2022 17:09
raw.githack.com test
raw.githack.com is working!
@neoascetic
neoascetic / watch.lua
Created June 15, 2018 08:38
Simple module watcher (for Love2D, but not necessarily - just replace the mtime function)
local m = {}
m.mods = {}
function m.mtime(filepath)
local info = love.filesystem.getInfo(filepath)
return info and info.modtime
end
'use strict';
var GoL = function () {
function touch(ctx, x, y, alive) {
ctx[alive ? 'fillRect' : 'clearRect'](x * 11, y * 11, 10, 10);
return alive;
}
function renderDiff(ctx, diff) {
for (var d of diff) touch(ctx, d[0], d[1], d[2]);
@neoascetic
neoascetic / sass-lint-junit-xml-reporter.rb
Created December 23, 2014 18:06
[SCSS] JUnit formatter for scss-lint
module SCSSLint
# Reports lints in an JUnit (XML) format.
class Reporter::JUnitReporter < Reporter
def report_lints
output = "<?xml version=\"1.0\"?>\n"
output << "<testsuite name=\"SCSS\" tests=\"#{lints.count}\" failures=\"#{lints.count}\">\n"
lints.group_by(&:filename).each do |filename, file_lints|
output << "<testcase name=#{filename.encode(xml: :attr)} failures=\"#{file_lints.count}\">\n"
@neoascetic
neoascetic / 1.8.1.diff
Last active August 29, 2015 14:10
[Homebrew] Irrlicht patches for OSX 10.10
diff --git a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm
index 8b48134..948e347 100644
--- a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm
+++ b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm
@@ -718,7 +718,7 @@ bool CIrrDeviceMacOSX::createWindow()
if (!CreationParams.WindowId)
{
[Window center];
- [Window setDelegate:[NSApp delegate]];
+ [(NSFileManager *)Window setDelegate:[NSApp delegate]];
@neoascetic
neoascetic / prefix.less
Last active August 29, 2015 14:07
[less] vendor prefixer mixin
// code from https://github.com/neoascetic/compless
// >> .prefix(box-shadow, 5px);
// -webkit-box-shadow: 5px;
// -moz-box-shadow: 5px;
// -ms-box-shadow: 5px;
// -o-box-shadow: 5px;
// box-shadow: 5px;
//
// >> .prefix(box-shadow, 5px, webkit ms);
@neoascetic
neoascetic / testing.php
Last active September 9, 2020 14:06
[Laravel] Bootstrap file for (re)creating database before running tests
<?php
/**
* Bootstrap file for (re)creating database before running tests
*
* You only need to put this file in "bootstrap" directory of the project
* and change "bootstrap" phpunit parameter within "phpunit.xml"
* from "bootstrap/autoload.php" to "bootstap/testing.php"
*/