Skip to content

Instantly share code, notes, and snippets.

View domtalbot's full-sized avatar

Dominic Talbot domtalbot

View GitHub Profile
$scope.$watch(function(){
return $window.innerWidth;
}, function(value) {
if(value < 480) {
} else {
}
@domtalbot
domtalbot / backup-to-s3.sh
Created February 12, 2016 11:49 — forked from MikeRogers0/backup-to-s3.sh
A method of backing up your website to Amazon S3.
#!/bin/bash
## Email Variables
EMAILDATE=`date --date="today" +%y-%m-%d`
EMAIL="you@yourdomain.com"
SUBJECT="[servername] Backup Script Started! - "$EMAILDATE
EMAILMESSAGE="/tmp/emailmessage1.txt"
echo "Just to let you know that the backup script has started."> $EMAILMESSAGE
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
#!/bin/bash
# Original script courtesy of Sonia Hamilton
# http://blog.snowfrog.net/2005/11/16/backup-multiple-databases-into-separate-files/
# Modified by QWeb Ltd to:
# - work more securely on Plesk servers
# - keep existing backups for 2 days
# http://www.qweb.co.uk/
<?php
namespace Predis;
class PredisException extends \Exception { }
class ClientException extends PredisException { } // Client-side errors
class AbortedMultiExec extends PredisException { } // Aborted multi/exec
class ServerException extends PredisException { // Server-side errors
public function toResponseError() {
return new ResponseError($this->getMessage());
<?php
/**
* WP Redix Index
*
* Redis caching system for WordPress. Inspired by Jim Westergren.
*
* @author Jeedo Aquino
* @see http://www.jeedo.net/lightning-fast-wordpress-with-nginx-redis/
* @see http://www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/
*/
index wp-index-redis.php index.php;
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
}
location ~ \.php$ {
set $no_cache "";
import React, { PropTypes, Component } from 'react';
import { connect } from 'react-redux';
import { Map } from 'immutable';
import CMS from 'netlify-cms';
export default class DynamicPreview extends Component {
static propTypes = {
onChange: PropTypes.func.isRequired,
onAddAsset: PropTypes.func.isRequired,
onRemoveAsset: PropTypes.func.isRequired,
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { Map } from 'immutable';
import CMS from 'netlify-cms';
export default class DynamicControl extends Component {
static propTypes = {
onChange: PropTypes.func.isRequired,
onAddAsset: PropTypes.func.isRequired,
onRemoveAsset: PropTypes.func.isRequired,
@domtalbot
domtalbot / control.js
Created March 21, 2018 14:32
Netlify Custom Widget
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Map } from 'immutable';
import CMS from 'netlify-cms';
export default class DynamicControl extends React.Component {
static propTypes = {
onChange: PropTypes.func.isRequired,
onAddAsset: PropTypes.func.isRequired,