Skip to content

Instantly share code, notes, and snippets.

View gustavomdsantos's full-sized avatar
👨‍💻
Working as an IT manager

Gustavo Moraes gustavomdsantos

👨‍💻
Working as an IT manager
  • Universidade Federal de Goiás
  • Brasília, Distrito Federal
View GitHub Profile
@anaisbetts
anaisbetts / stat-cache.js
Last active April 11, 2019 05:07
Make your Electron apps load faster, with this One Weird Trick
// Include this at the very top of both your main and window processes, so that
// it loads as soon as possible.
//
// Why does this work? The node.js module system calls fs.realpathSync a _lot_
// to load stuff, which in turn, has to call fs.lstatSync a _lot_. While you
// generally can't cache stat() results because they change behind your back
// (i.e. another program opens a file, then you stat it, the stats change),
// caching it for a very short period of time is :ok: :gem:. These effects are
// especially apparent on Windows, where stat() is far more expensive - stat()
// calls often take more time in the perf graph than actually evaluating the
@lingceng
lingceng / form_submit.js
Last active October 31, 2020 00:19
JavaScript request like a form submit
// http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit
// form_submit('/contact/', {name: 'Johnny Bravo'});
function form_submit(path, params, method) {
method = method || "post"; // Set method to post by default if not specified.
// The rest of this code assumes you are not using a library.
// It can be made less wordy if you use one.
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
@denilsonsa
denilsonsa / README.md
Last active August 15, 2023 05:01 — forked from noromanba/README.md
add permanently HEAD links on Gist for UserScript
anonymous
anonymous / activity_main.xml
Created April 8, 2015 22:18
RelativeLayout XML for Udacity quiz question
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<TextView
android:text="I’m in this corner"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@LeoIannacone
LeoIannacone / monokai-exteded.xml
Last active October 26, 2023 15:50
Monokai Extended - GtkSourceView Theme
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2014 Leo Iannacone <info@leoiannacone.com>
This file was generated from a textmate theme named Monokai Extended
with tm2gtksw2 tool. (Alexandre da Silva)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@tehshane
tehshane / Microsoft Sculpt Mobile Keyboard Remap
Last active March 9, 2024 05:18
AutoHotKey script that remaps the F1-F12 function keys on the Microsoft Sculpt Mobile keyboard to be pressed without having to use the Fn key. Disables some of the Windows 8 shortcuts, but leaves media keys intact.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#InstallKeybdHook
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; OPTIONAL: For those who use Home/End more than PgUp/PgDown, this flips their use with the Fn key.
; If you want the buttons to function as they are, add a semicolon (;) to the beginning of each line below.
Home::PgUp
End::PgDn
PgUp::Home
@kirilloid
kirilloid / jsPrimitiveCompare
Last active August 27, 2022 04:59
JavaScript primitive (non-strict) comparison table
// italics for objects
(function (values) {
function toString(x) {
var v = x;
v = (v || v === "") ? JSON.stringify(v) : String(v);
if (typeof x === 'object') v = v.italics();
return v;
}
function describe (i,j) {
var v1 = values[i],