Skip to content

Instantly share code, notes, and snippets.

Rasmus Thulstrup thulstrup

Block or report user

Report or block thulstrup

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@FredyC
FredyC / App.js
Created Sep 6, 2017
Update Expo app
View App.js
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Util } from 'expo'
export default class App extends React.Component {
state = {
updated: false,
}
componentWillMount() {
Util.addNewVersionListenerExperimental(() => {
View react-statless-funcs.md

#A brief intro into Stateless functions#

So stateless functions are new in React 0.14 which are quite interesting. They look a bit like this.

const Test = ({name, amount}) => {
  return <div className="test">{name} has £{amount}</div>;
};

ReactDOM.render(<Test name="ben" amount="-2000" />) //  <div className="test">ben has £-200</div> 
@paulirish
paulirish / what-forces-layout.md
Last active Oct 23, 2019
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@tlrobinson
tlrobinson / redux-devtools-separate-window.js
Last active Aug 20, 2019
Put the awesome redux-devtools in it's own window so it doesn't obscure or be obscured by your application
View redux-devtools-separate-window.js
// give it a name so it reuses the same window
var win = window.open(null, "redux-devtools", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no");
// reload in case it's reusing the same window with the old content
win.location.reload();
// wait a little bit for it to reload, then render
setTimeout(function() {
React.render(
<DebugPanel top right bottom left >
@maximilianschmitt
maximilianschmitt / gulpfile.js
Created Apr 27, 2015
Using watchify with gulp
View gulpfile.js
'use strict';
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var notifier = require('stream-notifier');
var watchify = require('watchify');
gulp.task('browserify', function() {
var bundler = browserify('./src/main')
View bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
View gulp-svgstore.js
var cheerio = require('gulp-cheerio');
var svgmin = require('gulp-svgmin');
var svgstore = require('gulp-svgstore');
gulp.task('svgstore', function () {
return gulp
.src('assets/icons/*.svg')
.pipe(svgmin())
.pipe(svgstore({ fileName: 'icons.svg', prefix: 'icon-' }))
.pipe(cheerio({
@pburtchaell
pburtchaell / styles.css
Last active Oct 10, 2019
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
View styles.css
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@cubiq
cubiq / select-reset.html
Created May 27, 2014
How to reset a select tag
View select-reset.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Styled Select</title>
</head>
<style>
* {
@Snugug
Snugug / server.bash
Created Oct 26, 2013
OS X 10.9 (Mavericks) comes with PHP 5.4.17 out of the box, allowing you to start a PHP development server in any directory by running `php -S localhost:8888` with `8888` being the port number you'd like to use. This is a little bash/zsh function to reduce that to `server 8888`. Simply add this to `bash_profile` or `zshconfig`. For more on the P…
View server.bash
server() {
php -S localhost:"$*";
}
You can’t perform that action at this time.