Skip to content

Instantly share code, notes, and snippets.

View thulstrup's full-sized avatar

Rasmus Thulstrup thulstrup

View GitHub Profile

#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> 
@maximilianschmitt
maximilianschmitt / gulpfile.js
Created April 27, 2015 18:24
Using watchify with gulp
'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')
@mirisuzanne
mirisuzanne / 1_index.html
Created April 4, 2012 22:58
Suggested syntax for responsive Susy layouts
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
<link rel="stylesheet" href="stylesheets/screen.css">
</head>
<body>
<div class="container c1"></div>
<div class="container c2"></div>
@antsa
antsa / mq.scss
Last active March 2, 2019 16:41
Media Query mixin - @MQ
// A mixin for media queries: @mq
//
// Use with keywords in $medias array:
// @include mq($media: iphone) {
// ...
// }
//
// Use with manual queries:
// @include mq("all and (min-width:33em)") {
// ...
@davatron5000
davatron5000 / gulp-svgstore.js
Last active May 13, 2019 05:48
Gulpin' SVGz
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({
@tlrobinson
tlrobinson / redux-devtools-separate-window.js
Last active August 20, 2019 23:54
Put the awesome redux-devtools in it's own window so it doesn't obscure or be obscured by your application
// 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 >
@jacine
jacine / template.php
Created November 19, 2011 01:02
Bye, bye region.tpl.php and block--system--main.tpl.php
<?php
/**
* Implements hook_page_alter().
*/
function mytheme_page_alter(&$page) {
// Remove all the region wrappers.
foreach (element_children($page) as $key => $region) {
if (!empty($page[$region]['#theme_wrappers'])) {
$page[$region]['#theme_wrappers'] = array_diff($page[$region]['#theme_wrappers'], array('region'));
@Snugug
Snugug / server.bash
Created October 26, 2013 18:22
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…
server() {
php -S localhost:"$*";
}
@jimmynotjim
jimmynotjim / more-mute-regex.md
Created July 19, 2012 14:37 — forked from imathis/tweetbot-mute-regex.md
Tweetbot can use regular expressions to mute tweets in your timeline and mentions.

##Simply annoying Tweets

Annoyingly extended words (4+ of the same letter in a phrase): OOOOHHHHMMMMYYYYGGGGOOOODDDD

([a-z])/1{4}

Tweet w/ just a single hashtag: #omgthissucks

^ *#[^ ]+$
@ddemaree
ddemaree / _retina.scss
Created April 26, 2013 20:49
Example Sass mixin for a "bulletproof" Hi-DPI media query
@mixin retina($ratio: 1.5) {
$dpi: $ratio * 96;
$opera-ratio: $ratio * 100;
@media only screen and (-webkit-min-device-pixel-ratio: #{$ratio}),
only screen and ( -o-min-device-pixel-ratio: '#{$opera-ratio}/100'),
only screen and ( min-resolution: #{$dpi}dpi),
only screen and ( min-resolution: #{$ratio}dppx) {
@content;
}