Skip to content

Instantly share code, notes, and snippets.

View killerbytes's full-sized avatar

Joel Carlos killerbytes

  • SMILEUPPS-EEAA4883DF
  • SMILEUPPS-EEAA4883DF
View GitHub Profile
@killerbytes
killerbytes / git squash
Created November 28, 2022 02:12
merge multiple commits
git rebase -i HEAD~<num_of_commits>
# leave first commit "pick" and change others to "squash"
# leave just one commit message and comment the others
git commit -a
git push -f
@killerbytes
killerbytes / downloadFile.js
Created December 26, 2020 07:55 — forked from davalapar/downloadFile.js
Download response.data as a file, through Blob()
// 'downloadFile.js', written by blending two solutions:
// 'js-download' https://github.com/kennethjiang/js-file-download
// 'Anders Paulsen' https://blog.jayway.com/2017/07/13/open-pdf-downloaded-api-javascript/
export function downloadFile(data, filename, mime) {
// It is necessary to create a new blob object with mime-type explicitly set
// otherwise only Chrome works like it should
const blob = new Blob([data], {type: mime || 'application/octet-stream'});
if (typeof window.navigator.msSaveBlob !== 'undefined') {
// IE doesn't allow using a blob object directly as link href.
@killerbytes
killerbytes / github_multiple-accounts.md
Created August 1, 2019 04:43 — forked from JoaquimLey/github_multiple-accounts.md
How to Work with GitHub and Multiple Accounts

Step 1 - Create a New SSH Key

We need to generate a unique SSH key for our second GitHub account.

ssh-keygen -t rsa -C "your-email-address"

Be careful that you don't over-write your existing key for your personal account. Instead, when prompted, save the file as id_rsa_COMPANY. In my case, I've saved the file to ~/.ssh/id_rsa_work.

Step 2 - Attach the New Key

// ==UserScript==
// @name AMAZON currency converter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.amazon.com/*
// @match https://www.amazon.co.uk/*
// @grant none
// @require http://code.jquery.com/jquery-latest.js
import Ember from 'ember';
import DS from 'ember-data';
/**
* Returns true iff the number passed in is even
* @param {Number} x
* @return {Boolean}
*/
function isEven(x) {
return x % 2 == 0;
http://rubular.com/r/oFpzy43wUg
((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s]))
var delay = (function() {
var timer = 0;
return function(callback, ms) {
clearTimeout(timer);
timer = setTimeout(callback, ms);
};
})();
$(window).resize(delay(function() {
someFunction()....
@killerbytes
killerbytes / gist:3485284
Created August 27, 2012 03:30 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@killerbytes
killerbytes / gist:3280922
Created August 7, 2012 02:49
CSS: Image Replacement
//image replacement
.ir {
font: 0/0 "image replace";
position: relative;
display: inline-block;
background-repeat: none;
}
@killerbytes
killerbytes / gist:3050623
Created July 5, 2012 02:14
Javascript: delay
var delay = (function() {
var timer = 0;
return function(callback, ms) {
clearTimeout(timer);
timer = setTimeout(callback, ms);
};
})();