Skip to content

Instantly share code, notes, and snippets.

View hamlim's full-sized avatar
💻
Working on side projects

Matt Hamlin hamlim

💻
Working on side projects
View GitHub Profile
@hamlim
hamlim / dabblet.css
Created December 6, 2013 02:08
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
/*#box1 {
background: red;
height: 20px;
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
void merge(vector<int> out, vector<int> left, vector<int> mid, vector<int> right){
vector<int> temp (out.size());
int total = 0;
int lft = 0;
int md = 0;
@hamlim
hamlim / gist:7a862aa8dcb3adc2cb5d
Created October 21, 2014 16:33
whats wrong here?
#include <iostream>
using namespace std;
int change(int n){
int val = n;
int num = 0;
while(val > 0){
if(val > 50){
num = num + 1;
@hamlim
hamlim / safari-nomodule.js
Last active May 13, 2017 21:00 — forked from samthor/safari-nomodule.js
Safari 10.1 `nomodule` support
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.:
* <script nomodule>alert('no modules');</script>.
*
* This workaround is possible because Safari supports the non-standard 'beforeload' event.
* This allows us to trap the module and nomodule load.
@hamlim
hamlim / snippet.js
Created May 22, 2017 12:21
Curried function Event Handlers in React
class Comp extends Component {
handleClick = (...args) => e => {
console.log(args, e);
}
render() {
return <button onClick={this.handleClick('args')}>Click Me</button>;
}
}
@hamlim
hamlim / _partialA.scss
Last active May 22, 2017 18:19
Shared Variable File in Sass
@mixin FeatureComponentA() {
.FeatureComponentA {
color: $Feature-color;
border-radius: $Feature-radius;
}
}
@hamlim
hamlim / snippet.css
Created May 29, 2017 19:02
Font Stack
:root {
--fontFamilies: -apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Oxygen-Sans,
Ubuntu,
Cantarell,
"Helvetica Neue",
sans-serif;
@hamlim
hamlim / index.js
Created May 29, 2017 21:45
React-Redux without Context.
import React, { Component } from 'react';
import { render } from 'react-dom';
const connect = (
mapStateToProps,
mapDispatchToProps = {},
) => WrappedComponent => {
return class ConnectedComponent extends Component {
render() {
return (
@hamlim
hamlim / The New way.md
Last active July 3, 2017 21:43
How to get styled-jsx (with plugins) working with CRA
@hamlim
hamlim / index.js
Created September 2, 2017 23:38
React and Old App Interop
/*
Lets say you want to adopt react into an old app that is using some other framework
without re-writing all of the app in one go you decide to go step by step.
Now lets also say that you want to be able to compose the entire app in one
component/state tree. However you have a chunk of it that you know you don't want to
change over just yet:
<Old App>