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
// declaration
function foo (n) { return n + 1; }
// expression
// note, fat arrow functions have very different meaning (usually what I want, though)
var foo = function (n) { return n + 1; };
var foo = (n) => { return n + 1; };
var foo = n => n + 1;
// object methods
// Make strings safe for innerHTML and attribute insertion (templates):
var escapeHTML = (function() {
var entityMap = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;'
},
re = /[&<>"']/g;
@awatson1978
awatson1978 / gist:a0df5fef953b9da01ce1
Last active May 19, 2017 11:57
Publish an Atom Package
command-shift-P > Package > Package Generator: Generate Syntax Theme > mypackage
cd ~/.atom/packages/mypackage
apm login
apm develop mypackage
cd ~/github/mypackage
sudo chown -R username:wheel .
git commit -a -m 'checking everything in'
apm publish --tag v2.5.0 minor
@rsms
rsms / 00-README.md
Last active September 22, 2021 14:10
Example programs and tests for the POSIX Asynchronous file I/O

There are some tests ripped out from git://repo.or.cz/ltp-debian.git/testcases/open_posix_testsuite/conformance/interfaces and made self-containing. They demonstrate and can be used to test the POSIX AIO interface for asynchronous I/O and formerly file IO.

Build with a c compiler (for instance clang or cc):

cc -o aio_read-test aio_read-test.c && ./aio_read-test

Note: Contrary to popular belief, it has been tested and confirmed to actually be asynchronous on Darwin 10.6.0 (xnu 1504.9.26~3).

import { multiSortBy } from 'src/shared/utils'
export type PathNode<T> = {
id: string
path: string
parentId: string
meta: T
children?: PathNode<T>[]
}
@kongchen
kongchen / gist:941a652882d89bb96f87
Created March 18, 2015 06:09
utf8 utf16 in javascript
/**
* Convert a UTF16 string to UTF8.
* @param {String} input
* @returns {String}
*/
utf16To8: function (input) {
var _unescape = function(s) {
function d(x, n) {
return String.fromCharCode(parseInt(n, 16));
}
@henriquez
henriquez / gist:3146782
Created July 19, 2012 21:00
Example Javascript that uses ajax proxy to make request to Chatter API
<apex:page controller="CustomerCommunityController" id="customercommunitycontroller" sidebar="false" showHeader="false" standardStylesheets="false" >
<head>
<title>Acme Customer Support</title>
<meta charset="utf-8" />
<apex:includeScript value="{!$Resource.jquery}"/>
</head>
<script type="text/javascript">
@chaance
chaance / use-transition.ts
Last active January 10, 2023 02:00
Convert `useNavigation` to `useTransition`
import * as React from "react";
import { useNavigation, type Navigation } from "@remix-run/react";
export function useTransition(): Transition {
let navigation = useNavigation();
return React.useMemo(
() => convertNavigationToTransition(navigation),
[navigation]
);
@connor
connor / .jshintrc.js
Created January 11, 2012 22:20
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`.

History

For a long time I've been really impacted by the ease of use Cassandra and CockroachDB bring to operating a data store at scale. While these systems have very different tradeoffs what they have in common is how easy it is to deploy and operate a cluster. I have experience with them with cluster sizes in the dozens, hundreds, or even thousands of nodes and in comparison to some other clustered technologies they get you far pretty fast. They have sane defaults that provide scale and high availability to people that wouldn't always understand how to achieve it with more complex systems. People can get pretty far before they have to become experts. When you start needing more extreme usage you will need to become an expert of the system just like any other piece of infrastructure. But what I really love about these systems is it makes geo-aware data placement, GDPR concerns potentially simplified and data replication and movement a breeze most of the time.

Several years ago the great [Andy Gross](ht