Skip to content

Instantly share code, notes, and snippets.

💻
Working

Xavier Gómez Gosálbez hiulit

💻
Working
Block or report user

Report or block hiulit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hiulit
hiulit / outline-gles2.shader
Created Sep 20, 2019
Godot 3 Outline Shader GLES2
View outline-gles2.shader
shader_type canvas_item;
uniform float width;
uniform vec4 outline_color : hint_color;
void fragment()
{
vec2 size = (vec2(width) * TEXTURE_PIXEL_SIZE);
vec4 sprite_color = texture(TEXTURE, UV);
@hiulit
hiulit / light-shader.shader
Last active Sep 26, 2019
Godot 3 light interact with shader
View light-shader.shader
shader_type canvas_item;
uniform vec4 dawn_color : hint_color = vec4(0.86, 0.70, 0.70, 1.0);
uniform vec4 day_color : hint_color = vec4(1.0, 1.0, 1.0, 1.0);
uniform vec4 dusk_color : hint_color = vec4(0.59, 0.66, 0.78, 1.0);
uniform vec4 night_color : hint_color = vec4(0.07, 0.09, 0.38, 1.0);
uniform float brightness : hint_range(0.0, 10.0, 0.01) = 1.0;
uniform float contrast : hint_range(0.0, 10.0, 0.01) = 1.0;
uniform float saturation : hint_range(0.0, 10.0, 0.01) = 1.0;
@hiulit
hiulit / install-virtualbox-guest-additions-linux.md
Last active Jul 12, 2018
Install VirtualBox Guest Additions on Linux
View install-virtualbox-guest-additions-linux.md
  1. In VirtualBox, choose Insert Guest Additions CD image... from the Devices menu.
  2. Next, you'll need to install the Guest Additions in a Terminal window.
    sudo sh /media/cdrom[n]/VBoxLinuxGuestAdditions.run
  3. Reboot.
  4. After rebooting, open a new Terminal and use the following command.
    lxrandr
    
@hiulit
hiulit / open-dev-tools-startup
Last active Jun 18, 2018
Open desire folder and dev tools on startup
View open-dev-tools-startup
tell application "<APP_NAME>" to activate
tell application "<APP_NAME>" to activate
tell application "<APP_NAME>" to activate
# Change 'defaultFolder' to your 'Projects' folder.
set defaultFolder to alias "<PATH:TO:FOLDER:>" # Use ':' instead of '/'
set projectFolder to (choose folder with prompt "Select project folder" default location defaultFolder)
set projectFolder to POSIX path of projectFolder
tell application "Terminal"
# Change 'code' for 'sublime' or any text editor.
do script "cd " & projectFolder & " && git pull && code . && history -c"
@hiulit
hiulit / javascript-object-empty-function.js
Created May 16, 2018
Function to check if a JavaScript Object is empty
View javascript-object-empty-function.js
function isObjectEmpty(obj) {
for(var key in obj) {
if(obj.hasOwnProperty(key))
return false
}
return true
}
var myObj = {}; // Empty Object
if(isObjectEmpty(myObj)) {
@hiulit
hiulit / sort-array-object.js
Created Apr 27, 2018
Simple function to sort an array of objects
View sort-array-object.js
function sortByKey(array, key) {
return array.sort(function(a, b) {
var x = a[key];
var y = b[key];
if (typeof x == "string") {
x = (""+x).toLowerCase();
}
if (typeof y == "string") {
y = (""+y).toLowerCase();
}
@hiulit
hiulit / git-auto-complete-macos-terminal.md
Last active Jun 25, 2018
Git auto-complete on macOS Terminal
View git-auto-complete-macos-terminal.md

You must have brew installed

  • Open the Terminal and enter brew install bash-completion.
  • Now enter open ~/.bash_profile.
  • At the end of the file paste the code below:
# Bash completion
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
@hiulit
hiulit / show_git_branch_macos_terminal.md
Last active Mar 12, 2018
Show git branch on macOS Terminal
View show_git_branch_macos_terminal.md
  • Open the Terminal and enter open ~/.bash_profile
  • At the end of the file, paste the code below:
# Git branch in prompt.
parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
@hiulit
hiulit / xmlstarlet_delete_tag_value.sh
Created Feb 28, 2018
xmlstarlet delete tag containing certain value
View xmlstarlet_delete_tag_value.sh
xmlstarlet ed -L -d "/path/to/tag[contains(text(),'some text')]" "path/to/file"
@hiulit
hiulit / convert_unhyphenated_datetime.sh
Created Feb 28, 2018
Convert unhyphenated datetime (20180228T125033) into 2018-02-28T12:50:33
View convert_unhyphenated_datetime.sh
date="$(echo "20180228T125033" | cut --output-delimiter=$'-' -c1-4,5-6,7-8)"
time="$(echo "20180228T125033" | cut --output-delimiter=$'-' -c10-11,12-13,14-15)"
date --utc --date "$date $time" +%s
You can’t perform that action at this time.