Skip to content

Instantly share code, notes, and snippets.

View jasloe's full-sized avatar
💭
I may be slow to respond.

Jason Loeffler jasloe

💭
I may be slow to respond.
View GitHub Profile
@jareware
jareware / SCSS.md
Last active July 1, 2024 09:25
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@jaydrogers
jaydrogers / amazons3move-sitesandfull.sh
Created April 3, 2014 16:16
CRON Job that will execute moving backup files to Amazon S3. Usage info here: http://serversideup.netmedia-temple-amazon-s3-backup-and-other-linux-servers
#! /bin/bash
# Author: Jay Rogers - jay@521dimensions.com
#IMPORTANT -- CONFIGURATION VARIABLES
BACKUPDOMAIN=backup.mydomain.com
SITESBUCKETNAME=myserver-plesksites
SERVERBUCKETNAME=myserver-pleskfull
#Check to see if there are any individual SITES to back up. If so, move the backups to Amazon S3
if [ "$(find /var/www/vhosts/$BACKUPDOMAIN/s3backups/sites/ -name "*.tar")" ]; then
@johanneswuerbach
johanneswuerbach / rails-vagrant-provision.sh
Last active June 29, 2020 19:24
Provision a vagrant box with ruby stable (using rvm), postgres, redis and node (using nvm)
#!/usr/bin/env bash
sudo locale-gen en_US.UTF-8
sudo update-locale LANG=en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8
sudo apt-get update
sudo apt-get install -y build-essential git curl libxslt1-dev libxml2-dev libssl-dev
# postgres
@oskarnrk
oskarnrk / mod_xml2enc-installer.sh
Last active December 14, 2020 01:09
Install mod_xml2enc for Apache2 in Ubuntu 13.10 or later
#!/bin/sh
sudo apt-get install apache2-prefork-dev libxml2 libxml2-dev apache2-dev
mkdir ~/modbuild/ && cd ~/modbuild/
wget http://apache.webthing.com/svn/apache/filters/mod_xml2enc.c
wget http://apache.webthing.com/svn/apache/filters/mod_xml2enc.h
sudo apxs2 -aic -I/usr/include/libxml2 ./mod_xml2enc.c
cd ~
sudo rm -rfd ~/modbuild/
sudo service apache2 restart
@rikki-iki
rikki-iki / drupal-preprocess.theme
Last active February 7, 2023 01:47
Useful preprocess theme functions (may use deprecated php)
<?php
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Url;
use Drupal\node\NodeInterface;
use Drupal\Core\Link;
/**
* Implements hook_preprocess_page() for page.html.twig.
@raphaellarrinaga
raphaellarrinaga / drupal_8_twig_cheatsheet.md
Last active July 20, 2023 21:21
[Drupal 8 Twig cheatsheet] #tags: drupal8, twig, cheatsheet

Drupal 8 Twig cheatsheet

Please note I created that sheet as a personal side note/draft and not everything is fully tested. There could be errors or better things to do. So if you spot something wrong or something that can be improved, feel free to comment below and I will do the changes.

Getting Drupal 8 field values in Twig

Image path: {{ file_url(content.field_name['#items'].entity.uri.value) }}

@DianaEromosele
DianaEromosele / Change "origin" of your GIT repository
Created August 7, 2016 00:31
Change "origin" of your GIT repository
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
@rocketeerbkw
rocketeerbkw / example.php
Last active June 23, 2023 18:42
How to migrate multi-value link field in Drupal 8
<?php
class Example extends SourcePluginBase {
public function prepareRow(Row $row) {
parent::prepareRow($row);
// I do some data manipulation to end up with an array that looks like this,
// which I want to import into multi-value link field.
$links = [
@jibran
jibran / FileEntity.php
Created March 24, 2017 00:39
Migrating Drupal 7 File Entities to Drupal 8 Media Entities
<?php
// modules/custom/my_custom_module/src/Plugin/migrate/source/FileEntity.php
namespace Drupal\my_custom_module\Plugin\migrate\source;
use Drupal\Core\Database\Query\Condition;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
/**
* Drupal 7 file_entity source from database.
@gaboratorium
gaboratorium / isIE.js
Created June 6, 2017 12:43
Detect IE with JavaScript #ie #edge #js #javascript
// Forked from https://codepen.io/gapcode/pen/vEJNZN
// Get IE or Edge browser version
var version = detectIE();
if (version === false) {
document.getElementById('result').innerHTML = '<s>IE/Edge</s>';
} else if (version >= 12) {
document.getElementById('result').innerHTML = 'Edge ' + version;
} else {