Skip to content

Instantly share code, notes, and snippets.

@urre
urre / restrictions.conf
Created October 30, 2012 19:20
Nginx restrictions
# Global restrictions configuration file.
# Designed to be included in any server {} block.
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
@urre
urre / gist:30523173fb22e3a375fa
Created October 27, 2014 13:44
Slick.js slider with thumbnails
$('.specs__slider').slick({
dots: true,
centerMode: true,
focusOnSelect: true,
arrows: false,
customPaging: function(slider, i) {
return '<div class="thumbnails">' +$(slider.$slides[i]).find('img').prop('outerHTML')+ '</div>';
}
});
@urre
urre / wordpress-w3-total-cache.conf
Created October 30, 2012 19:21
Nginx W3 Total Cache config
# BEGIN W3TC Browser Cache
gzip on;
gzip_types text/css application/x-javascript text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
location ~ \.(css|js)$ {
expires 31536000s;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
add_header X-Powered-By "W3 Total Cache/0.9.2.3";
}
location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
@urre
urre / gist:3319920e694b821a2ad0e5a361fdbe4d
Created August 28, 2017 10:33
Laravel Mix with Stylelint and Browsersync
let mix = require('laravel-mix');
let StyleLintPlugin = require('stylelint-webpack-plugin');
mix.webpackConfig({
plugins: [
new StyleLintPlugin({
files: './assets/sass/**/*.scss',
configFile: './.stylelintrc'
}),
]
@urre
urre / gist:846b89237da760839b3d
Last active January 5, 2021 21:26
Get network wide recent posts from a WordPress Multisite (1 post from every blog except main site), order by date and only show author once (unique authors). Used on http://vertikals.se/
<?php
// Get all blog ids in network except main site (id 1)
$blogs = $wpdb->get_results("
SELECT blog_id
FROM {$wpdb->blogs}
WHERE site_id = '{$wpdb->siteid}'
AND spam = '0'
AND deleted = '0'
AND archived = '0'
fetch('https://www.tweetjs.com/API.aspx', {
body: JSON.stringify({
Action: 'ListTweetsOnUserTimeline',
ScreenName: 'urre',
}),
method: 'POST',
})
.then((r) => r.json())
.then((data) => {
console.log(data)
@urre
urre / custom-feed.php
Created December 14, 2019 14:46
WordPress Custom RSS feed
<?php
/*
Plugin Name: Custom RSS Feed for App
Description: A plugin creating a customized rssfeed
Plugin URI: https://urre.me/
Author: Urban Sandén
Author URI: https://urre.me
*/
// Add dates for rss feed
@urre
urre / config.yml
Last active June 28, 2019 07:30
CircleCI config for WordPress with Bedrock
version: 2
jobs:
build:
working_directory: ~/clone
docker:
- image: circleci/php:7.1-node-browsers
steps:
- checkout
@urre
urre / config.yml
Created December 7, 2018 13:37
Circle CI config for Jekyll
version: 2
jobs:
build:
docker:
- image: circleci/ruby:2.5.0-node
working_directory: ~/repo
steps:
- checkout
@urre
urre / unsplash.sh
Created June 19, 2014 09:06
Fetch image urls from unsplash.com
#!/bin/bash
# **************************************************************************************
#
# Fetch image urls from Unsplash.com
# by @urre
#
# **************************************************************************************
# JSON with 100 images from unsplash.com