Skip to content

Instantly share code, notes, and snippets.

View rrrhys's full-sized avatar

Rhys Williams rrrhys

View GitHub Profile
<?php // You need to add server side validation and better error handling here
$data = array();
if(isset($_FILES))
{
$error = false;
$files = array();
$uploaddir = './uploads/';
@rrrhys
rrrhys / Quick git add-commit-push-server pull.md
Last active August 29, 2015 14:11
Git shortcut bash file for windows - show modified files, ask for commit message, commit and push to remote.

How to:

Run ssh-keygen to generate a private/public keypair on your development machine.

Copy contents of id_rsa.pub to clipboard.

Paste the id_rsa.pub contents into ~/.ssh/authorized_keys on the server.

Change "111.222.333.444" to your remote server IP. (deploy.bat)

@rrrhys
rrrhys / quick HTML + Bootstrap + JS libs
Created August 11, 2014 11:17
Bootstrap + JQuery + Moment.js + Cookies.js from CDN template
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="initial-scale=1">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<link href="/path/to/css/site.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.7.0/moment.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/Cookies.js/0.4.0/cookies.min.js"></script>
@rrrhys
rrrhys / Create Screenshot of supplied CSS selector
Created April 20, 2012 07:01 — forked from n1k0/gist:1501173
PhantomJS: Capturing single dom elements as png files
var page = new WebPage(),
address, output, size;
var retval = {};
retval.result = "failed";
retval.messages = [];
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs
capture = function(targetFile, clipRect) {
try {