Skip to content

Instantly share code, notes, and snippets.

View brunoais's full-sized avatar
🎯
Focusing

brunoais brunoais

🎯
Focusing
View GitHub Profile
@brunoais
brunoais / proton
Last active January 23, 2024 18:48 — forked from thingsiplay/proton
Proton script
#!/bin/bash
# Execute Windows programs with Proton from Steams installation folder, without
# starting Steam client.
#
# 1. Create a directory for Proton environment to run in. As an example make a
# folder "proton" in your home directory. This folder must exist in order
# to make Proton work.
#
# 2. Point the variable "env_dir" in this script to that folder or...
@brunoais
brunoais / README.md
Last active September 19, 2021 15:12
[Tutorial] PlayOnLinux: Run command line programs while keeping work dir

PlayOnLinux: Run command line programs while keeping work dir

Intro

For this demo, I will provide an example on how to run pingo (image compressor) as a command line program with the help of PlayOnLinux.

Pingo doesn't really need the benefits of PlayOnLinux but other programs may.

In this case, I wanted to use a specific wine version which is not the default in my system and because pingo is very simple to install and have (just a self-conntained executable) it's easier to demonstrate and show how to do.

@brunoais
brunoais / loadingjQueryAsync(minified).html
Created February 1, 2013 12:06
This is a commented example code about adding jQuery in an async way. As long as you don't use jQuery stuff outside the fake ready() or in functions/methods that are called before the ready() method, all works without any modifications. Tested on IE 7+, FF 3.6+, Chrome 24, Opera 12.
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">(function(a,c,d){function b(b,c){"ready"==b?a.bindReadyQ.push(c):a.readyQ.push(b)}a.readyQ=[];a.bindReadyQ=[];var e={ready:b,bind:b};a.$=a.jQuery=function(a){if(a===c||a===d)return e;b(a)}})(window,document);function jQOk(){var a=jQuery,c=document;a.each(readyQ,function(c,b){a(b)});a.each(bindReadyQ,function(d,b){a(c).bind("ready",b)})} function jQErr(){var a=document.createElement("script");a.type="text/javascript";a.src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js";a.async=!1;a.defer=!1;a.onload=jQOk;document.getElementsByTagName("head")[0].appendChild(a)};</script>
<script async type="text/javascript"src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"onload="jQOk()"onerror="jQErr()"></script>
<!--[if lte IE 8]><script type="text/javascript">if("undefined"==typeof jQuery.fn){jQErr();var interval=setInterval(function(){jQOk();clearInterval(interval)},100);setTimeout(function(){clearInterval(interval)},12E3)};</sc
//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence : Improved by brunoais
(function(win, doc){
if(win.addEventListener)return; //No need to polyfill
function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}}
function addEvent(on, fn, self){
// There are events IE does not support. This will translate those to the best option available
switch(on){
case 'DOMContentLoaded': on = 'load';
break;
@brunoais
brunoais / input
Created December 14, 2012 22:25
parsing example
[b child="0"]
[u child="0,1"]
[b child="0,1,0"]
[/b]
[/u]
[/b]
[b child="1"]
another bold
[b child="1,0"]
[/b]
@brunoais
brunoais / gist:4286536
Created December 14, 2012 16:06
Wierd parsing of phpBB's 3.0 parser
Wiered parses:
[quote="[b]name[/b]"]text[/quote]
[quote="[i]name[/i]"]text[/quote]
[quote="[i]something[/i] [u]name[/u]"]text[/quote]
....etc...etc...
A parameter in a bbcode tag is forcibly differently written deppending on the tag itself:
[quote=name][/quote] is invalid.
[quote="name"][/quote] is valid.
and
@brunoais
brunoais / jbbcode_test.php
Created December 10, 2012 08:11
Testing alternative BBCode parsers
header("content-type:text/plain");
require_once( "jBBCodeIn1.php" );
$parser = new JBBCode\Parser();
$parser->loadDefaultCodes();
$text = '
[b]
[b]
boldy!
@brunoais
brunoais / idea_for_ACP.html
Created December 8, 2012 17:53
phpBB BBcode Parser
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div>
<form action="">
<p>
@brunoais
brunoais / parser_Test.php
Created December 6, 2012 21:39
phpbb tests gist
<?php
/**
*
* @package testing
* @version $Id$
* @copyright (c) 2008 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
$phpbb_root_path = __DIR__ . '/../../phpBB/';
@brunoais
brunoais / gist:1957683
Created March 2, 2012 10:49
Testing js performance. Which option is best?
<html>
<head>
<script>
var myfunction = function (){};
(function (w) {
// Define two queues for handlers
w.readyQ = [];
w.bindReadyQ = [];