Skip to content

Instantly share code, notes, and snippets.

@Dobby89
Dobby89 / Responsive background sprite
Created June 28, 2015 18:42
Very simple method of creating a responsive image sprite using background images (good with an SVG image sprite)
// The mixin
@mixin responsive-sprite(
$sprite-path,
$sprite-width,
$sprite-height,
$icon-width,
$icon-height,
$icon-pos-x,
$icon-pos-y){
vagrantfile:
target: local
vm:
provider:
local:
box: puphpet/debian75-x64
box_url: puphpet/debian75-x64
box_version: '0'
chosen_virtualizer: virtualbox
virtualizers:
@Dobby89
Dobby89 / Regex recipes.md
Last active July 14, 2021 14:04
Regex recipes
@Dobby89
Dobby89 / Delete Directory on Windows
Last active December 1, 2016 16:15
Delete a folder which has loads of child directories which cannot be deleted using Window's File Explorer. Read more here: https://blog.bertvanlangen.com/articles/path-too-long-use-robocopy/
robocopy temp_empty_folder folder_to_delete /purge
git remote set-url origin new-repo-url.git
@Dobby89
Dobby89 / Bash Commands.md
Last active January 13, 2022 17:47
Windows Terminal / Bash commands

Copy the output of the terminal directly into your clipboard (this works with Git Bash at least !)

<command> | clip

List all global NPM packages/modules

npm list -g --depth 0
@Dobby89
Dobby89 / Create a test file
Created December 1, 2016 16:18
Creates a 1Mb file called 1Mbfile.png in Windows Cmd
fsutil file createnew 1Mbfile.png 1000000
@Dobby89
Dobby89 / group_concat.sql
Created December 9, 2016 16:05
SQL Query with Concat and Group Concat
SELECT
p.product_id,
pd.name,
pd.description,
pd.title_tag AS meta_title,
pd.meta_keywords,
pd.meta_description,
CONCAT('http://www.domain.co.uk/', u.keyword) AS URL,
GROUP_CONCAT(pt.tag) AS tags,
p.status
.ao-seo-tool {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
min-height: 100%;
font-family: Arial, sans-serif;
}
@Dobby89
Dobby89 / flattenArray.js
Created July 26, 2017 15:06
Flatten a multi-dimensional array in JavaScript
var arr = [1,2,3,4,[5,5,[1,1,1],6,7],[1,2,[2,3,[100,[23,45,11,[600,599]],101,99],4],3]];
function flattenArray(array) {
return array.reduce(function(accumulator, current) {
if (Array.isArray(current)) {
return accumulator.concat(flattenReduce(current));
} else {
return accumulator.concat(current);
}
}, []);