Skip to content

Instantly share code, notes, and snippets.

👍
asdf

Christopher Scott Hernandez christopherscott

View GitHub Profile
@christopherscott
christopherscott / in-memory-list-react.jsx
Last active Sep 28, 2018
adding/removing limited num items, react
View in-memory-list-react.jsx
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
state = {
contacts: [],
}
@christopherscott
christopherscott / react-portal-animated-modals.jsx
Created Sep 20, 2018
Difference between react-spring and react-transition-group animated modals
View react-portal-animated-modals.jsx
import Component from "@reach/component-component";
import { Transition } from 'react-spring';
import { Transition as Transition2 } from 'react-transition-group';
import ReactDOM from 'react-dom';
import React from 'react';
import logo from './logo.svg';
import './App.css';
const style = {
padding: 10,
@christopherscott
christopherscott / gist:5017707
Last active Dec 14, 2015
The Walrus And The ECMAScripter
View gist:5017707
// Another attempt at understanding monads by translating into my lingua franca
// http://www.infoq.com/presentations/Why-is-a-Monad-Like-a-Writing-Desk
// the return operation is prefixed with underscore because 'return' is a reserved name in ECMAScript
// Part 1: The door
// ================
// Is it true that this could be a monadic return operation?
var _return = function(v) {
View js-inheritance-lib-objects-only
var Lib2 = {
extend: function (props) {
var sub = Object.create(this);
sub = mixin(sub, props);
sub.super = this;
return sub;
}
};
var Person = Lib.extend({
@christopherscott
christopherscott / js-inheritance-lib-classes-instances
Created Feb 11, 2013
Prototypical inheritance in JavaScript with 'classes' and 'instances'
View js-inheritance-lib-classes-instances
var Lib = {
extend: function (props) {
var sub = mixin(Object.create(this), props);
sub.super = this;
return sub;
},
create: function () {
var instance = Object.create(this);
if (instance.init) { instance.init.apply(instance, arguments); }
return instance;
@christopherscott
christopherscott / js-inheritance-prototypical
Created Feb 11, 2013
Prototypical inheritance in JavaScript
View js-inheritance-prototypical
var Person = {
init: function (name) {
this.name = name;
},
speak: function () {
console.log(this.name);
}
};
var Employee = Object.create(Person);
@christopherscott
christopherscott / js-inheritance-psuedo-classical
Last active Dec 12, 2015
Psuedo classical inheritance in JavaScript
View js-inheritance-psuedo-classical
function Person(name) {
this.name = name;
}
Person.prototype.speak = function () {
console.log(this.name);
};
function Employee(name) {
@christopherscott
christopherscott / dabblet.css
Created Nov 11, 2012
CScott CSS/mobile logo
View dabblet.css
/**
* CScott CSS/mobile logo
*/
html {
font-family: 'Source Sans Pro', Arial, sans-serif;
background: url('http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/noisy_grid.png');
}
#logo {
@christopherscott
christopherscott / dabblet.css
Created Nov 11, 2012
The first commented line is your dabblet’s title
View dabblet.css
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(35deg, #f06, yellow);
min-height:100%;
text-shadow: 4px 4px rgba(0,0,0,0.25);
@christopherscott
christopherscott / sourcegrep
Created Sep 6, 2012
Grep through document source
View sourcegrep
(function() {
// change this REGEXP to whatever you need
var PATTERN = /<title>(.*)<\/title>/g;
var message = '',
results = document.documentElement.innerHTML.match(PATTERN);
message = ((results && results.length) ? results.join('\n') : 'Not found.');
window.alert(message);
You can’t perform that action at this time.