Skip to content

Instantly share code, notes, and snippets.

View iam4x's full-sized avatar
🐧

iam4x iam4x

🐧
View GitHub Profile
@mattmccray
mattmccray / AltResolver.js
Last active August 29, 2015 14:17
AltResolver higher order component (decorator)
import {hasComponentChanged} from 'util'
const ignoredStatics= Object.getOwnPropertyNames( class {})
.concat([ '_altResolved', 'displayName', 'type'])
export var AltResolver= Wrapped => {
// Don't wrap a wrapper
if( '_altResolved' in Wrapped) return Wrapped
class Resolved extends React.Component {
@yannickcr
yannickcr / Resources.md
Last active September 15, 2016 09:31
React.js Conf 2015 - From the Internet
@dtran320
dtran320 / circle.yml
Last active October 13, 2016 00:15
Yarn on CircleCI
dependencies:
pre:
- curl -o- -L https://yarnpkg.com/install.sh | bash
override:
- yarn
post: # At least for me, it doesn't seem like `scripts` in `package.json` are being run, so you need to add them explicitly
- yarn run postinstall
@mweststrate
mweststrate / mobx.js
Created June 15, 2016 19:20
Local component state with MobX
import {observable} from "mobx"
import {observer} from "mobx-react"
@observer class Select extends React.Component {
@observable selection = null; /* MobX managed instance state */
constructor(props, context) {
super(props, context)
this.selection = props.values[0]
}
@GiamPy5
GiamPy5 / selectHierarchicalMenu.js
Last active March 17, 2021 13:55
Hierarchical Tree Menu with Select Box (instantsearch)
var customMenuRenderFn = function (renderParams, isFirstRendering) {
var container = renderParams.widgetParams.container;
var title = renderParams.widgetParams.title;
var templates = renderParams.widgetParams.templates;
var cssClasses = renderParams.widgetParams.cssClasses || "";
var attributes = renderParams.widgetParams.attributes.map(function (attribute) {
return attribute.replace('.', '___');
});
var currentSelectedValue = null;
@ardcore
ardcore / atom-events
Last active October 13, 2021 20:35
atom.io events
application:open-your-keymap
application:open-your-stylesheet
autocomplete:attach
autoflow:reflow-paragraph
bookmarks:clear-bookmarks
bookmarks:jump-to-next-bookmark
bookmarks:jump-to-previous-bookmark
bookmarks:toggle-bookmark
bookmarks:view-all
check:correct-misspelling
@threepointone
threepointone / glam-for-css-folks.md
Last active September 4, 2022 07:43
why css purists will love glam

I made a little styling lib called glam

(some features are in development)

one

let's start off with the simplest use case. we'll make an 'index.html' page, and assume we've setup our js bundler to output bundle.js

@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@Warry
Warry / Article.md
Created December 11, 2012 00:11
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

@fwielstra
fwielstra / api.js
Created June 14, 2011 14:46
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');