Skip to content

Instantly share code, notes, and snippets.

@matiasherranz
matiasherranz / openInNewTab.ts
Created February 9, 2023 15:18
Open in new tabb method for onClick callback.
export const openInNewTab = (url: string) => {
const newWindow = window.open(url, '_blank', 'noopener,noreferrer')
if (newWindow) newWindow.opener = null
}
@matiasherranz
matiasherranz / USstates_avg_latLong
Created February 25, 2022 12:20 — forked from meiqimichelle/USstates_avg_latLong
JSON of US states (full names) and their average lat/long
[
{
"state":"Alaska",
"latitude":61.3850,
"longitude":-152.2683
},
{
"state":"Alabama",
"latitude":32.7990,
"longitude":-86.8073
import os
meses = [
'enero','febrero','marzo','abril','mayo', 'junio', 'julio',
'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre',
]
resultados = []
for mes in meses:
read_file = pd.read_excel(os.path.join(path, mes, + ".xlsx"), "Hoja1")
$ git checkout feature/my-feature
$ git rebase -i master
$ git checkout master
$ git merge --no-ff feature/my-feature
$ git push origin master
$ git branch -d feature/my-feature
$ git checkout feature/my-feature
$ git rebase -i master
$ git checkout master
$ git merge --ff-only feature/my-feature
$ git push origin master
$ git branch -d feature/my-feature
$ git checkout -b feature/my-feature master
@matiasherranz
matiasherranz / demo.html
Last active September 22, 2017 15:56
On this gist I implemented a full demo / proof-of-concept for the Page Visibility API + Vanilla JS DOM ready implementation.
<!--
Reference: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
-->
<html>
<head>
<title>Aloha!</title>
<script>
// START OF: VanillaJS implementation for DOM ready
window.readyHandlers = [];
window.ready = function ready(handler) {
function generateUUID() {
let d = new Date().getTime();
if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
d += performance.now(); //use high-precision timer if available
}
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
let r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
@matiasherranz
matiasherranz / parse_error_codes.js
Last active June 2, 2017 14:31
Full set of error codes for ParseJS
/**
* Parse JavaScript SDK v1.9.2
*
* The source tree of this library can be found at
* https://github.com/ParsePlatform/Parse-SDK-JS
*/
# Create a branch to play safe in
--> (git: master m) $ git checkout -b rebase_example
Switched to a new branch 'rebase_example'
# Create a file
--> (git: rebase_example m) $ touch some_file.txt
# Add it to git
--> (git: rebase_example ? m) $ git add some_file.txt