Skip to content

Instantly share code, notes, and snippets.

View l00f00's full-sized avatar
πŸˆβ€β¬›
Working from LabZero

l00f00 l00f00

πŸˆβ€β¬›
Working from LabZero
  • Cyberfreak Creative Studio - Websmith.it - LabZero Shared Workspace
View GitHub Profile
@l00f00
l00f00 / download-github-repo.js
Created May 16, 2024 16:09 — forked from miwaniec/download-github-repo.js
Download zipped repository from github. If repo is private, you have to use token (create in user profile).
const request = require('request');
const fs = require('fs');
const repo = 'miwaniec/socket-camera';
const accessToken = ''; /* for private repo, use token - https://github.com/settings/tokens */
var options = {
method: 'GET',
url: 'https://api.github.com/repos/' + repo + '/zipball/',
encoding: 'binary',
@l00f00
l00f00 / .gitignore
Created December 18, 2023 11:01 — forked from pingrishabh/.gitignore
Standardised gitignore for your Flutter apps & Dart projects
### Flutter Generated
# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
.DS_Store
.atom/
@l00f00
l00f00 / cusTOom oxygen element to encode mail adress
Created May 11, 2023 10:54
A custom component that encodes an email address, how-to-write-a-custom-oxygen-element-using-a-code-snippet
//CREDITS https://wpcodebox.com/how-to-write-a-custom-oxygen-element-using-a-code-snippet/
<?php
add_action('plugins_loaded', function() {
class EncodeEmail extends OxyEl {
function init() {
}
@l00f00
l00f00 / Minimal Oxygen component
Created May 11, 2023 10:35
boilerplate code to render a custom component, we need to define a class that extends Oxygen's internal OxyEl class. We do this in the WordPress 'plugins_loaded' action to ensure the Oxygen plugin is loaded and OxyEl is available.
<?php
add_action('plugins_loaded', function() {
class HeadingElement extends OxyEl {
function init()
{
}
//https://www.youtube.com/watch?v=mjLsbRgQ2k4
add_action( 'wp_head', function () { ?>
<style>
:root {
/*Begin First Varible Code*/
--primary: <?php
$primary_color = rwmb_meta( //Change the variable to your desired varible name
'primary_color_picker', //Color Picker ID
['object_type' => 'setting'],
@l00f00
l00f00 / Oxygen add js
Created May 11, 2023 10:15
some handy tips about oxygen an js
To start, open a code block or JS advanced tab. Then wrap your JS with the following:
(function($){
// Your code goes here. You can use $!
})(jQuery);
What we have above is called an anonymous and self-executing function.
Adding the parentheses at the end calls the function immediately after declaration (hence, self-executing). We can then pass the jQuery object as a parameter, which we decide to represent as the common $ symbol within our code block.
//Getting the Component ID
@l00f00
l00f00 / migration steps
Created April 30, 2023 15:45
migrate oxygen site
Properly migrate Oxygen sites using the All-in-One WP Migration plugin
All-in-One WP Migration plugin is one of the best free (depending on the file size) back-up and migration tools out there - period. I use it for every single project. Here are the steps to achieve a successful migration.
Step 1: Dowload and activate the All-in-One WP Migration plugin if you do not already have this on the WP install you wish to migrate.
Step 2: Export the site in question via: wp-admin dashboard > All-in-One WP Migration > Export > Export To > File and then click the green Download prompt.
Step 3: Dowload and activate the All-in-One WP Migration plugin if you do not already have this in the WP install you wish to migrate the site to.
@l00f00
l00f00 / exclude from oxygen query
Last active April 30, 2023 16:33
exclude from query oxygen easypost/repeater
add "Code Block" oxygen element.
This Code block has to be placed BEFORE the "Easy Post" element.
___________________________________________________________________________________single post
/**
* Exclude Current Posts from the query
*/
add_action( 'pre_get_posts', function ( $query ) {
// not an admin page and not the main query
if ( ! is_admin() && ! $query->is_main_query() ) {
$query->set( 'post__not_in', array( get_the_ID() ) );
@l00f00
l00f00 / media queies for oxygen
Created November 29, 2022 02:07
some media queries for oxygen builder, they can be customised, i always find myelf looking for the defaults, there you go
xl = All Devices (> 1120px)
l = Page Container (1120px and below)
md = Tablet Landscape (Less than 992px)
s = Tablet (Less than 768px)
xs = Mobile (Less than 480px)
@media screen and (max-width:1120px) {
}
@l00f00
l00f00 / gist:53e64f417e2679e7afe3832e11243135
Created October 22, 2022 12:24
metabox relationships fileds get all the posts related based on matching relationship
<?php
$getartist = new WP_Query( [
'relationship' => [
'id' => 'opera_artist_relationship',
'from' => get_the_ID(),
],
'nopaging' => true,
] );
while ( $getartist->have_posts() ) : $getartist->the_post();
?>