Skip to content

Instantly share code, notes, and snippets.

View diegocard's full-sized avatar

Diego Cardozo diegocard

View GitHub Profile
@diegocard
diegocard / gh-pages-deploy.md
Created August 3, 2016 02:02 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@diegocard
diegocard / JS Editor Bookmarklet.html
Last active February 24, 2022 04:12
JavaScript editor bookmarklet (open in a new tab)
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://ace.c9.io/build/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script src="http://ace.c9.io/build/src-noconflict/ext-language_tools.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.setOptions({enableBasicAutocompletion:true});e.getSession().setMode("ace/mode/javascript");addEventListener("keydown",function(evt){if(evt.ctrlKey && evt.keyCode==13) eval(e.getSession().getValue());});var link=document.createElement("link");link.type="image/x-icon";link.rel="shortcut icon";link.href="https://raw.githubusercontent.com/diegocard/diegocard.github.io/master/images/icon.png";document.getElementsByTagName("head")[0].appendChild(link);</script>
@diegocard
diegocard / Preferences.sublime-settings
Last active November 23, 2015 19:42
Sublime text user settings
{
"color_scheme": "Packages/Material_Monokai.tmTheme",
"font_size": 12,
"highlight_line": true,
"ignored_packages":
[
"Markdown",
"Vintage"
],
"line_padding_bottom": 3,
@diegocard
diegocard / Material_Monokai.tmTheme
Last active August 29, 2015 14:23
Monokai color scheme for Sublime Text 3 material theme (http://equinusocio.github.io/material-theme/)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Seti_Monokai</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@diegocard
diegocard / keyLookup.js
Last active August 29, 2015 14:22
Find an object key deeply nested in an object (requires underscore)
function keyLookup(obj, string) {
if (_.isObject(obj)) {
var path = null;
_.find(obj, function(value, key) {
if (_.isString(key) && key.includes(string)) {
path = key.toString();
return true;
} else if (_.isObject(value) && !_.isFunction(value)) {
var foundKeyValueRec = keyLookup(value, string);
// Call recursively
@diegocard
diegocard / Less debug.sublime-build
Created October 10, 2013 13:33
Less debugging build script for sublime text
{
"cmd":
[
"lessc",
"--source-map",
"--compress",
"--verbose",
"$file",
"${file_base_name}.css"
],