Skip to content

Instantly share code, notes, and snippets.

View zanonnicola's full-sized avatar
💭
I like Kotlin

Nicola Zanon zanonnicola

💭
I like Kotlin
View GitHub Profile
@averyvery
averyvery / spread.sass
Last active May 16, 2020 22:07
spread.sass
// strip-units required by spread mixin
// http://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass
@function strip-units($number)
@return $number / ($number * 0 + 1)
// pow and sqrt required by ease function
// adapted from https://github.com/at-import/Sassy-math/blob/master/sass/math.scss
@function pow($base, $exponent)
$value: $base
@WickyNilliams
WickyNilliams / README.md
Last active September 24, 2020 11:01
So you want to publish a react component?!

So you want to publish a react component?!

This is a quick guide of what you need to do to publish a react component for use by others. This guide is distilled from a conversation [0] on twitter. I will reference individual tweets, where appropriate (thereby shifting blame for incorrect advice from me to the authors :D)

Assumptions

  1. You are using some sort of module system in your source
  2. You have a build step
  3. You want broad support for your component (browser-ready, npm compatible, consumable by bower)
@jonmaim
jonmaim / csv2js.js
Last active November 23, 2020 11:00
Function takes a CSV (header + data) string as input and gives back a JS object.
// Start from https://gist.github.com/iwek/7154578#file-csv-to-json-js
// and fix the issue with double quoted values
function csvTojs(csv) {
var lines=csv.split("\n");
var result = [];
var headers = lines[0].split(",");
for(var i=1; i<lines.length; i++) {
var obj = {};
@developit
developit / *state-machine-component.md
Last active February 6, 2021 00:44
265b lib for building pure functional state machine components. https://github.com/developit/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments:

@danott
danott / modernizr-tests.js
Created March 4, 2011 16:55
Custom Modernizr tests that are useful.
/* modernizr-test.js
* Daniel Ott
* 3 March 2011
* Custom Tests using Modernizr's addTest API
*/
/* iOS
* There may be times when we need a quick way to reference whether iOS is in play or not.
* While a primative means, will be helpful for that.
*/
@LayZeeDK
LayZeeDK / web-application-horizontal-layers.csv
Last active January 19, 2023 11:57
Horizontal layers of a web application.
Horizontal layer Examples
Business logic Application-specific logic, domain logic, validation rules
Persistence WebStorage, IndexedDB, File System Access API, HTTP, WebSocket, GraphQL, Firebase, Meteor
Messaging WebRTC, WebSocket, Push API, Server-Sent Events
I/O Web Bluetooth, WebUSB, NFC, camera, microphone, proximity sensor, ambient light sensor
Presentation DOM manipulation, event listeners, formatting
User interaction UI behaviour, form validation
State management Application state management, application-specific events
@michael-cannon
michael-cannon / tw_remove_menu_pages.php
Created September 25, 2013 16:00
Remove custom post type submenu pages.
<?php
function tw_remove_menu_pages() {
// remove testimonials menu section
// remove_menu_page( 'edit.php?post_type=testimonials-widget' );
// remove categories
remove_submenu_page( 'edit.php?post_type=testimonials-widget', 'edit-tags.php?taxonomy=category&amp;post_type=testimonials-widget' );
// remove tags
@kentcdodds
kentcdodds / with-foo.js
Created November 15, 2017 16:18
Which of these is a higher order component?
// Which of these things is the "Higher Order Component?"
function withFoo(Component) { // <-- this is a function, not a component
class Wrapper extends React.Component { // <-- this is a component
static displayName = `withFoo(${Component.displayName || Component.name})`
static propTypes = {innerRef: PropTypes.func}
static WrappedComponent = Component
render() {
const {innerRef, ...remainingProps} = this.props
return <Component {...remainingProps} foo="FOO!" ref={innerRef} />
@mcollina
mcollina / principles.md
Last active May 18, 2023 18:27
Matteo's Technical principles

Matteo Technical Principles

1. Conway’s Law is paramount.

Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure.

In order to design a piece of software we need to “design” the team that is going to produce it.

2. Developer Experience is key to productivity

@joelambert
joelambert / README
Created June 1, 2011 11:03
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php