Skip to content

Instantly share code, notes, and snippets.

View cliffordfajardo's full-sized avatar
🏠
Working from home

Clifford Fajardo cliffordfajardo

🏠
Working from home
View GitHub Profile
@cliffordfajardo
cliffordfajardo / .jshintrc.js
Created November 13, 2015 18:58 — forked from connor/.jshintrc.js
jshintrc example
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
@cliffordfajardo
cliffordfajardo / gist:98e7fac159770a310489
Created December 30, 2015 11:37 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
// Make strings safe for innerHTML and attribute insertion (templates):
var escapeHTML = (function() {
var entityMap = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;'
},
re = /[&<>"']/g;
@cliffordfajardo
cliffordfajardo / 0_reuse_code.js
Created January 28, 2016 20:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@cliffordfajardo
cliffordfajardo / string_search.js
Created March 16, 2016 20:25 — forked from amoilanen/string_search.js
Rabin-Karp Algorithm for Searching Strings Implemented in JavaScript
function simpleSearch(text, str) {
var matches = [];
for (var i = 0; i <= text.length; i++) {
if (matchesAtIndex(i, text, str)) {
matches.push(i);
}
}
return matches;
}

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@cliffordfajardo
cliffordfajardo / trello-md-code-highlight.js
Created July 29, 2017 20:31 — forked from AsyncWizard/trello-md-code-highlight.js
Trello markdown code syntax highlight.
// ==UserScript==
// @name Trello Syntax Highlight
// @namespace https://gist.github.com/AsyncWizard
// @version 0.1
// @description try to take over the world!
// @author AsyncWizard
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/highlight.min.js
// @resource https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/styles/github.min.css
// @match https://trello.com/*
// @grant none

Remix request cheatsheet

Navigates? declarative? Makes GET, triggers loader Makes POST, triggers action No requests
navigates declarative <Link to="">
<Form method="get">
<Form method="post"> <Link to="#...">
navigates imperative navigate()
setSearchParams()
submit() navigate("#")
stays declarative <fetcher.Form method="get"> <fetcher.Form method="post"> (doesn't make sense)
stays imperative fetcher.load() fetcher.submit() (doesn't make sense)

where

@cliffordfajardo
cliffordfajardo / css_grid_draggable.html
Created March 11, 2022 15:20 — forked from ismasan/css_grid_draggable.html
Example for reordering CSS grids layout
<html>
<head>
<title>grid</title>
<style>
body {padding: 0; margin: 0;}
.container {
display: grid;
grid-template-rows: 200px repeat(4, 100px);
grid-template-columns: repeat(4, 1fr);
grid-template-areas: "header header header header"
@cliffordfajardo
cliffordfajardo / github-proxy-client.js
Created March 18, 2022 20:59 — forked from DavidWells/github-proxy-client.js
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})