Skip to content

Instantly share code, notes, and snippets.

View sqndr's full-sized avatar
🏞️

Sander Tirez sqndr

🏞️
View GitHub Profile
@sqndr
sqndr / render.js
Created April 30, 2020 07:39
Replace every instance with react component
import { render } from 'react-dom';
const renderComponent = (Component, root) => {
const parent = document.createElement('div');
render(Component, parent, () => {
root.replaceWith(...Array.from(parent.childNodes));
});
};
@sqndr
sqndr / README.md
Last active February 16, 2017 12:15
Adding action links to view page

Why?

Add a nice local action button to a administrative overview, as shown in the screenshot.

Link to add new ECK entity

eck.routing.yml:

@sqndr
sqndr / _spacing.scss
Created September 15, 2016 07:17
Bootstrap 4 | Responsive Grid Classes
@each $breakpoint in map-keys($grid-breakpoints) {
@each $prop, $abbrev in (margin: m, padding: p) {
@each $size, $lengths in $spacers {
@include media-breakpoint-down($breakpoint) {
$length-x: map-get($lengths, x);
$length-y: map-get($lengths, y);
.#{$abbrev}-#{$breakpoint}-a-#{$size} { #{$prop}: $length-y $length-x !important; } // a = All sides
.#{$abbrev}-#{$breakpoint}-t-#{$size} { #{$prop}-top: $length-y !important; }
.#{$abbrev}-#{$breakpoint}-r-#{$size} { #{$prop}-right: $length-x !important; }
@sqndr
sqndr / software.md
Last active October 19, 2015 11:10
Configuring a new mac.

Software

Browsers

Obviously; you'll need to install some browsers. It's always a good thing to install the latest stable and the latest development version.

  • Chrome
  • Chrome Canary
  • Firefox
  • Firefox Nightly
@sqndr
sqndr / gist:ff5de5da5d938aa01980
Created June 3, 2015 13:49
Drush Cache Clear
# Druch clear caches
alias dcca="drush cc all"
alias clearall="drush cc all"
alias cleardrush="drush cc drush"
alias cleartheme="drush cc theme-registry"
alias clearmenu="drush cc menu"
alias clearcss="drush cc css-js"
alias clearblock="drush cc block"
alias clearmodule="drush cc module-list"
alias cleartheme="drush cc theme-list"
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@sqndr
sqndr / box-sizing.css
Created September 10, 2014 08:34
Better box-sizing FTW
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
@sqndr
sqndr / kittens.js
Last active August 29, 2015 14:04
Kittens everywhere in IE
// Replace all images with kitten placeholder images in IE. #awesome
(function($) {
Drupal.behaviors.placeholder = {
attach: function() {
$('.ie').find('img').attr('src', 'http://placekitten.com/g/200/300');
}
};
})(jQuery);
@sqndr
sqndr / example.jquery.js
Created July 16, 2014 10:45
jQuery plugin example (js)
(function($){
$.fn.extend({
example: function(options) {
var defaults = {
color: '#000000',
}
@sqndr
sqndr / phantom-responsive.js
Created June 27, 2014 08:14
Phantom Responsive.
var async = require('async');
var sizes = [
[320, 480],
[600, 1024],
[1024, 768],
[1280, 800],
[1440, 900]
];
var url = 'http://one-pager.dev/nl';