Skip to content

Instantly share code, notes, and snippets.

View christopherscott's full-sized avatar
👍
asdf

Christopher Scott Hernandez christopherscott

👍
asdf
View GitHub Profile
@christopherscott
christopherscott / in-memory-list-react.jsx
Last active September 28, 2018 16:42
adding/removing limited num items, react
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 September 20, 2018 14:44
Difference between react-spring and react-transition-group animated modals
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 December 14, 2015 02:59
The Walrus And The ECMAScripter
// 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) {
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 February 11, 2013 22:11
Prototypical inheritance in JavaScript with 'classes' and '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 February 11, 2013 22:09
Prototypical inheritance in JavaScript
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 December 12, 2015 10:19
Psuedo classical inheritance in JavaScript
function Person(name) {
this.name = name;
}
Person.prototype.speak = function () {
console.log(this.name);
};
function Employee(name) {
@christopherscott
christopherscott / dabblet.css
Created November 11, 2012 15:44
CScott CSS/mobile logo
/**
* 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 November 11, 2012 15:39
The first commented line is your dabblet’s title
/**
* 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 September 6, 2012 14:47
Grep through document source
(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);