Skip to content

Instantly share code, notes, and snippets.

🐫
Remote

David Sancho davesnx

🐫
Remote
Block or report user

Report or block davesnx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@davesnx
davesnx / index.js
Last active Dec 20, 2019
Draft history hook
View index.js
const useHistory = initialValue => {
const [history, setHistory] = useState({ values: [initialValue], pointer: 0 })
const setHistoryPointer = pointer => {
if (pointer >= 0) {
setHistory({ ...history, pointer: pointer })
}
}
return [
@davesnx
davesnx / index.js
Created Jul 23, 2016
Basic compose explained
View index.js
// [IGNORE THIS]
// Clean the console on node(with strict mode!)
console.clear = () => {
process.stdout.write('\x1B[2J\x1B[0f')
}
console.clear()
// [IGNORE THIS]
// Simpler expect method
@davesnx
davesnx / index-spec.js
Created Jul 17, 2016
Example spec atom with jasmine
View index-spec.js
/** @babel */
/* eslint-env jasmine */
describe('#atom-jq export', () => {
let mainModule = null
beforeEach(() => {
waitsForPromise(() => {
return atom.packages.activatePackage('atom-jq').then((pack) => {
mainModule = pack.mainModule
You can’t perform that action at this time.