Skip to content

Instantly share code, notes, and snippets.

@rodrigobdz
rodrigobdz / import_bash_aliases.fish
Last active November 3, 2023 01:00 — forked from HiR0GeN/import_bash_aliases.fish
Fish function to import bash aliases to fish abbreviations
# Fish function to import bash aliases v0.2
# Copyright (C) 2016 Malte Biermann
# Copyright (C) 2017 Rodrigo Bermudez Schettino
# Released under the GPL
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@rodrigobdz
rodrigobdz / javascript.sublime-build
Last active January 27, 2018 15:28
Run a single Parse Server function using node
// Sublime Text - Build System for Javascript
//
// Created using the instructions shown in
// https://gist.github.com/corbanb/d0d6bdcfbd8eb455ce99
{
"cmd": ["/usr/local/bin/node", "$file"],
"selector": "source.js",
}
@rodrigobdz
rodrigobdz / parse_function_runner.html
Last active January 28, 2018 20:30
Run single Parse Server function in the browser
<html>
<head>
<script src="http://fb.me/react-0.13.3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/parse/1.10.0/parse.js"></script>
</head>
<style type="text/css">
* {
font-family: "Lucida Console", Monaco, monospace;
}
@rodrigobdz
rodrigobdz / ping.js
Last active February 13, 2023 14:46
Ping IP Address in React Native
fetch('http://localhost')
.then((response) => {
console.log('response ', response)
if (response.status === 200) {
console.log('success')
} else {
console.warn('error')
}
})
.catch((error) => {
@rodrigobdz
rodrigobdz / replace_line.sh
Last active January 28, 2018 20:45
Replace line in text file
#!/bin/bash
# Copyright (C) 2017 Rodrigo Bermudez Schettino
# Script to replace a line in a text file
# Create file with sample text
echo "this will be replaced" > file.txt
############
# file.txt #
############
@rodrigobdz
rodrigobdz / export_fish_abbreviations.fish
Last active November 3, 2023 20:32
Export fish abbreviations
#!/usr/local/bin/fish
# Use current date as name of file where fish
# abbreviations will be stored
# Format: YYYY-MM-DD
set -lx EXPORT_FILENAME (date "+%Y-%m-%d")
# Prepare destination fish script
echo "#!/usr/local/bin/fish" > $EXPORT_FILENAME.fish
# Write all abbreviations to file
@rodrigobdz
rodrigobdz / git_blame_sublime_statusbar.py
Created January 20, 2018 16:47
Show Git Blame info for the current line in the Sublime status bar
import sublime
import sublime_plugin
import os
import subprocess
from subprocess import check_output as shell
from datetime import datetime
try:
si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
@rodrigobdz
rodrigobdz / testMissingTranslations.js
Created January 21, 2018 16:22
Test for missing translations in i18n
import I18n from 'i18n'
const deepKeys = require('deep-keys');
const NO_DIFF = null
Object.defineProperty(Object.prototype, 'translations', {
get: function() {
let locale = Object.keys(this)[0]
return [ locale, this[locale] ]
@rodrigobdz
rodrigobdz / watch-and-reload.sh
Created January 27, 2018 14:52
Edit .svg files in macOS and livereload
#!/bin/bash
FILE_TO_WATCH=<PATH TO SVG>
filewatcher $FILE_TO_WATCH 'reload' "osascript -e 'tell application \"Safari\" to set URL of current tab of front window to \"file://$FILE_TO_WATCH\"'"
@rodrigobdz
rodrigobdz / mkfile-with-size.sh
Created February 20, 2018 08:07
Create empty file with a certain file size
#!/bin/bash
# Create an empty file with size 10 MB
mkfile -n 10m foo
# Create an empty file with size 1 GB
mkfile -n 1g foo