Skip to content

Instantly share code, notes, and snippets.

View gerardreches's full-sized avatar
🏠
Working from home

Gerard Reches gerardreches

🏠
Working from home
View GitHub Profile
@gerardreches
gerardreches / page-scrolled.js
Last active September 5, 2023 20:48
This code helps to apply custom CSS for sticky headers by adding a class named "page-scrolled" to the body tag when the user is scrolling through the page.
// This code helps to apply custom CSS for sticky headers by adding a class named "page-scrolled" to the body tag when the user is scrolling through the page.
<script>
var lastScrollYPosition = 0;
window.addEventListener('scroll', function() {
if (window.scrollY > 0) {
document.body.classList.add('page-scrolled');
} else {
document.body.classList.remove('page-scrolled');
}
@gerardreches
gerardreches / functions.php
Last active March 2, 2022 15:39
Hide WordPress admin bar for specific roles
function disable_admin_bar_for_roles() {
// Add here the roles you want to not have admin bar.
$excluded_roles = [ 'subscriber' ];
return is_user_logged_in() && ! array_intersect( wp_get_current_user()->roles, $excluded_roles);
}
add_filter('show_admin_bar', 'disable_admin_bar_for_roles');
# HEAD.BLADE.PHP
<script>
<?php
// copy all translations from /resources/lang/CURRENT_LOCALE/* to global JS variable
$lang_files = File::files(resource_path() . '/lang/' . App::getLocale());
$exclude_files = ['changelog'];
$translations = [];
foreach ($lang_files as $f)
{
@gerardreches
gerardreches / npm-commands.md
Last active November 30, 2016 15:50
npm basic console commands

Installing a package

npm install package-name
OR
npm i package-name

add the --no-bin-links option if you are in a Windows machine:

@gerardreches
gerardreches / Preferences.sublime-settings
Last active October 4, 2016 21:11
My sublime preferences
{
"color_scheme": "Packages/Colorsublime - Themes/Flatland_Monokai.tmTheme",
"theme": "Material-Theme.sublime-theme",
"material_theme_compact_panel": true,
"material_theme_tree_headings": true,
"ignored_packages": ["Vintage"],
// Font options
"font_face": "Fira Code",
"font_size": 14,
@gerardreches
gerardreches / install_oh-my-zsh.txt
Created September 28, 2016 17:10
Install oh-my-zsh with steeef theme on homestead
$ homestead ssh
$ sudo apt install zsh
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
$ vim ~/.zshrc
# Change
ZSH_THEME="steeef"