Skip to content

Instantly share code, notes, and snippets.

@jamiemagique
jamiemagique / user-settings.json
Created January 13, 2019 09:01
VSCode settings
{
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.fontFamily": "Meslo LG M for Powerline",
"terminal.integrated.fontSize": 12,
"files.insertFinalNewline": true,
"workbench.colorTheme": "Default Dark+",
"editor.tabSize": 2,
"editor.fontSize": 18,
"files.associations": {
"*.twig": "html",
@jamiemagique
jamiemagique / .eslintrc
Last active August 8, 2021 03:58
Pre commit JS and SCSS fixing via Husky, Lint-Staged and StyleLint with AirBnB linting.
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"extends": "airbnb",
"rules": {
"no-console":0,
"nomen": 0
@jamiemagique
jamiemagique / social-share-links.html
Last active March 18, 2016 16:24
Social share links
@jamiemagique
jamiemagique / scss-multiline-selectors-from-list.css
Created January 13, 2016 12:16
Sass multiline selectors from list
.swiper-wrapper,
.gallery-item-list,
.gallery-thumb-list {
background: #000;
}
@jamiemagique
jamiemagique / transition-complete.js
Created November 10, 2015 10:26
Transition complete JS function
$('.classname').on('webkitTransitionEnd moztransitionend transitionend oTransitionEnd', function () {
// Animation complete!
});
@jamiemagique
jamiemagique / SassMeister-input.scss
Last active September 2, 2015 15:38
Variable overriding with SASS
// ----
// libsass (v3.2.5)
// ----
$brand-color: purple !default;
$brand-color: orange;
$site-header-bg: $brand-color !default;
@jamiemagique
jamiemagique / script.js
Created March 11, 2015 10:47
yepnope() test example
yepnope([{
test: $('.CLASSNAME').length !== 0,
yep: Drupal.settings.basePath + Drupal.settings.pintSettings.pathToTheme + '/js/vendor/YES-FILENAME.js',
nope: Drupal.settings.basePath + Drupal.settings.pintSettings.pathToTheme + '/js/vendor/NOPE-FILENAME.js',
}]);
@jamiemagique
jamiemagique / script.js
Last active March 18, 2016 16:04
Modernizr.load, example of loading in conditional js files with yepnope with correct path to the Drupal theme
Modernizr.load({
test: Modernizr.touch,
nope: Drupal.settings.basePath + Drupal.settings.customThemeSettings.pathToTheme + '/js/vendor/FILENAME.js',
complete : function () {
// Run the function after the scripts have downloaded
doSomethingFunction();
}
});
function doSomethingFunction() {
@jamiemagique
jamiemagique / template.php
Last active July 18, 2024 08:31
Drupal 7 - Render an image using the picture module mappings programatically (via preprocess_node() in this gist)
// Get image settings array from a field on the node
$image = field_get_items('node', $node, 'INSERT_IMAGE_FIELD_MACHINE_NAME');
// Picture settings
$picture_mapping = picture_mapping_load('INSERT_PICTURE_MAPPING_MACHINE_NAME');
$fallback = 'INSERT_IMAGE_STYLE_MACHINE_NAME';
$breakpoints = picture_get_mapping_breakpoints($picture_mapping, $fallback);
// Create a new variable to pass through to the node template
$variables['INSERT_NEW_VARIABLE_NAME_TO_PASS_TO_NODE_TEMPLATE'] = theme('picture', array('uri' => $image[0]['uri'], 'style_name' => $fallback, 'breakpoints' => $breakpoints));