Skip to content

Instantly share code, notes, and snippets.

View dreamyguy's full-sized avatar
👨‍💻 Code-bending

Wallace Sidhrée dreamyguy

👨‍💻 Code-bending
View GitHub Profile
@dreamyguy
dreamyguy / find-files-older-than.sh
Last active April 29, 2016 08:57
Find files that are older than x days while excluding directories
find . -mtime +200 -name "*.js" -not -path "./components/*" -not -path "./node_modules/*" -not -path "./.git/*" -print
@dreamyguy
dreamyguy / IE10-11-and-IE12-conditions.scss
Created June 8, 2016 15:01
IE conditions for IE10-11 & MSEdge (IE12+)
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
// IE10+ styles go here
top: rem-calc(3);
}
// Reset styles for MSEdge, which usually works as well as Chrome
@supports (-ms-accelerator:true) {
// IEEdge 12+ styles go here
top: rem-calc(10);
}
@dreamyguy
dreamyguy / atom-editor-react.md
Created June 14, 2016 11:36
Atom - Useful packages and dependencies for Atom when developing with React
@dreamyguy
dreamyguy / a-toggler.js
Last active January 6, 2017 09:19
Generic toggler
$(function() {
// multi-toggler
var toggleItems = function(opts) {
var options = {
wrapper: 'wrapper', // id
toggler: 'toggler', // id
togglerOn: 'toggler-on', // class for toggler on state
togglerOff: 'toggler-off', // class for toggler off state
items: 'toggle-item', // class that will hide/show element(s)
classShow: 'toggle-show', // class applied to shown elements
@dreamyguy
dreamyguy / vertical-spacing.scss
Last active February 16, 2017 14:17
Vertical spacing mixin for Zurb Foundation
/* ===================================
* Vertical spacing for Zurb Foundation Grid
*
* Copyright (c) 2017, Wallace Sidhrée
* MIT License
====================================== */
$vs-positions: top bottom;
$vs-total: 8 !default; // range of classes to be created (in this case 1-8)
$vs: $gutter-size-half;
@dreamyguy
dreamyguy / position-absolute-center.css
Created March 24, 2017 15:01
Center absolutely positioned elements
.el-parent {
position: relative;
}
.el {
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
text-align: center;
}
@dreamyguy
dreamyguy / tt-using-dumper-to-find-data-structure.md
Last active April 19, 2017 08:46
How to find data structure on Template Toolkit with Dumper
@dreamyguy
dreamyguy / lazyScript.js
Last active July 31, 2017 08:01
Only lazy-load 3rd party script tag once the placeholder that interacts with it is visible on viewport
/* ===================================
* Only lazy-load 3rd party script tag once the placeholder that interacts with it is visible on viewport.
*
* Copyright (c) 2017, Wallace Sidhrée
* MIT License
====================================== */
var lazyScript = function(elId, scriptUrl, threshold) {
// polyfill requestAnimationFrame for ie9
window.requestAnimationFrame = window.requestAnimationFrame || function(f) { return setTimeout(f, 1000/60); };
@dreamyguy
dreamyguy / docker-problems.md
Last active August 4, 2017 10:48
Ultimate "Docker on macOS" problems solver

For when Docker acts up on you (macOS):

  1. Restart docker
  2. docker system prune (the secret sauce)
  3. docker login -u _token -p "$(gcloud auth print-access-token)" https://eu.gcr.io (authenticate if needed)
  4. docker-compose build --no-cache

If experiencing problems with npm modules or bower components:

  1. rm -rf /node_modules && rm -rf /bower_components/ && docker-compose build --no-cache
@dreamyguy
dreamyguy / svg-with-color.scss
Last active December 19, 2017 08:33
SVGs as background images WITH COLOR!
$cl-black: #000;
$cl-green: #bada55;
$cl-red: #f00;
@function _buildIcon($icon) {
$icon: '%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20#{$icon}%3C%2Fsvg%3E';
@return $icon;
}
@function _buildPath($path, $viewbox, $parameters) {