Skip to content

Instantly share code, notes, and snippets.

@Suaz
Suaz / batch_exporter_v2.py
Created December 31, 2024 00:56
Export bash for Blender
import bpy
import os
# Set the directory where you want to save the exported files
export_dir = "C:/path/to/export/directory"
# Ensure the directory exists
if not os.path.exists(export_dir):
os.makedirs(export_dir)
@Suaz
Suaz / batch_exporter.py
Created December 30, 2024 21:47
Export meshes from blender
import bpy
import os
# Set the directory where you want to save the exported files
export_dir = "/Users/csuaznabar/Documents/Blender/assets"
# Ensure the directory exists
if not os.path.exists(export_dir):
os.makedirs(export_dir)
@Suaz
Suaz / VarSize.ts
Created October 25, 2022 20:51
Get size of a variable in kb
export function memorySizeOf(obj) {
var bytes = 0
function sizeOf(obj) {
if (obj !== null && obj !== undefined) {
switch (typeof obj) {
case 'number':
bytes += 8
break
case 'string':
@Suaz
Suaz / useApi.ts
Created November 3, 2021 11:44
hook to handle apiCalls
import { useState } from 'react'
const useApi = (apiFunction: any) => {
const [data, setData] = useState()
const [error, setError] = useState(false)
const [loading, setLoading] = useState(false)
const request = async (...args: any[]) => {
try {
@Suaz
Suaz / useBackButton.js
Created December 19, 2019 14:40
hook to handle back button in ReactNative
import React, {useEffect} from 'react';
import {BackHandler} from 'react-native';
const useBackButton = (handler) => {
useEffect(() => {
BackHandler.addEventListener("hardwareBackPress", handler);
return () => {
BackHandler.removeEventListener(
"hardwareBackPress",
handler
<?php
$this->registerJsFile( 'https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest' );
$this->registerJsFile( 'https://cdn.jsdelivr.net/npm/@editorjs/header@latest' );
$this->registerJsFile( 'https://cdn.jsdelivr.net/npm/@editorjs/paragraph@latest' );
$this->registerJsFile( 'https://cdn.jsdelivr.net/npm/@editorjs/image@latest' );
$this->registerJsFile( 'https://cdn.jsdelivr.net/npm/@editorjs/link@latest' );
$this->registerJsFile( 'https://cdn.jsdelivr.net/npm/@editorjs/embed@latest' );
$this->registerJsFile( 'https://cdn.jsdelivr.net/npm/@editorjs/personality@latest' );
$this->registerJsFile( 'https://cdn.jsdelivr.net/npm/@editorjs/table@latest' );
chown -R apache:apache <dir>
chmod -R 755 <dir>
chcon -R -t httpd_sys_rw_content_t <dir>
Facebook:
http://www.facebook.com/sharer.php?u=[post-url]
Twitter:
https://twitter.com/share?url=[post-url]&text=[post-title]&via=[via]&hashtags=[hashtags]
Google+:
https://plus.google.com/share?url=[post-url]
Pinterest:
https://pinterest.com/pin/create/bookmarklet/?media=[post-img]&url=[post-url]&is_video=[is_video]&description=[post-title]
LinkedIn:
http://www.linkedin.com/shareArticle?url=[post-url]&title=[post-title]
@Suaz
Suaz / uploadbutton.js
Created August 11, 2018 01:13
React & material-ui upload field
<Button
raised
component="label"
color="primary"
disabled={this.state.loading}
>
{'Upload'}
<FileUpload className={classes.rightIcon}/>
<input
onChange={e => console.log(e.target.files[0])}
@Suaz
Suaz / ActionBarColor.java
Created November 13, 2015 13:12
ActionBar Color
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/ActionBar</item>
<item name="actionBarStyle">@style/ActionBar</item>
</style>
<!-- Actionbar Theme -->
<style name="ActionBar" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/verde_header</item>
<item name="background">@color/verde_header</item>
</style>