Skip to content

Instantly share code, notes, and snippets.

View Braunson's full-sized avatar

Braunson Yager Braunson

View GitHub Profile
@Braunson
Braunson / README.md
Last active August 29, 2015 14:18 — forked from oodavid/README.md

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@Braunson
Braunson / gist:aa83fb9531db5c580252
Last active August 29, 2015 14:17
Test Credit Card Account Numbers - PayPal

While testing, use only the credit card numbers listed here. Other numbers produce an error.

Expiration Date must be a valid date in the future (use the mmyy format).

Credit Card Type Credit Card Number
American Express 378282246310005
American Express 371449635398431
American Express Corporate 378734493671000
Australian BankCard 5610591081018250

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {
@Braunson
Braunson / index.php
Last active August 29, 2015 14:15 — forked from elsassph/index.php
<?php
// first create a new voice chat room:
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query(array()),
)
@Braunson
Braunson / dataTables.less
Created February 9, 2015 20:19
DataTables 1.10.4 converted to LESS
//
// Colour customisation
//
// Border between the header (and footer) and the table body
@table-header-border: 1px solid #111111;
// Border of rows / cells
@table-body-border: 1px solid #dddddd;
@Braunson
Braunson / gist:8aa2e0084098c84f0d8f
Created February 8, 2015 21:03
jQuery $.browser is deprecated, here's a drop in working fix to resolve $.browser errors so you can continue using $.browser.
(function( $ ){
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || [];
return {
@Braunson
Braunson / gist:a6ed85cc3d189dce2ce9
Created February 8, 2015 20:48
Custom jQuery Validator Methods/Rules for select drop downs.
// Custom validator method
$.validator.addMethod("valueNotEqualsVal", function(value, element, arg){
return arg != value;
}, "Value must not equal arg.");
$.validator.addMethod("valueNotEqualsTxt", function(value, element, arg){
return return arg != jQuery(element).find('option:selected').text();
}, "Value must not equal arg.");
// Usage
input {
height: 34px;
width: 100%;
border-radius: 3px;
border: 1px solid transparent;
border-top: none;
border-bottom: 1px solid #DDD;
box-shadow: inset 0 1px 2px rgba(0,0,0,.39), 0 -1px 1px #FFF, 0 1px 0 #FFF;
}
@Braunson
Braunson / gist:42d2b507a160c5bb38f6
Last active August 29, 2015 14:12
Quick write to file with date/time, very crude.
function logToFile($msg) {
$filename = 'logfile.log';
if(is_array($msg)){
file_put_contents($filename, print_r($msg, true), FILE_APPEND);
} else {
$fd = fopen($filename, "a");
$str = "[" . date("Y/m/d h:i:s", mktime()) . "] " . $msg;
fwrite($fd, $str . "\n");
fclose($fd);