Skip to content

Instantly share code, notes, and snippets.

View onliniak's full-sized avatar

Rafael Pszenny onliniak

View GitHub Profile
@onliniak
onliniak / composer.json
Created September 18, 2019 13:28
Phug templates partial rendering
{
"require":{
"phug/phug":"^0.3.2"
}
}
@onliniak
onliniak / .htaccess_public
Last active September 16, 2019 14:14
[PHP] simple MVC router and public directory (Appache)
#public/.htaccess
RewriteEngine On
RewriteBase /public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
@onliniak
onliniak / app.rb
Last active September 29, 2019 17:41
Slim template engine in Roda framework
class Test < Roda
plugin :render, engine: 'slim'
route do |r|
r.get 'test' do
view :hello
end
r.root do
'Home, Sweet Home'
end
@onliniak
onliniak / app.rb
Created September 16, 2019 13:25
Receive POST parameters from rack/Roda app
class Test < Roda
route do |r|
r.root do
'<form action="login" method="post">
<input type="email" name="user">
<input type="password" name="pass">
<input type="submit">
</form>'
end
r.post 'login' do
@onliniak
onliniak / gist:63228f8ddc2fb535ffdd8d0c9f1bdaab
Created April 28, 2019 22:12
WordPress author_meta custom wrapper
# Custom Functions
// Destination: author.php
// Arguments: $ocean_cream_author_field = $field from https://codex.wordpress.org/Template_Tags/the_author_meta
// $ocean_cream_author_localization = name of field in ocean_cream.pot file.
// https://stackoverflow.com/questions/18860870/translation-function-calls-must-not-contain-php-variables
// $ocean_cream_author_hide_me = practically nothing. This function show field only, when field with this same name in profile.php is not empty.
// $ocean_cream_author_string_me = practically nothing. This function rewrite your variable to string type.
// $ocean_cream_author_display_translation = rewrite $ocean_cream_author_localization to accepted translation and allow me translate it in Loco Translate … or another program. Clue: Today, we cannot create automatic translations, so you have to add it manually in /languages/ocean-cream.pot
// $ocean_cream_author_class_body_start = for example <span class="abc"> or <dd class "abc">
// $ocean_c