Skip to content

Instantly share code, notes, and snippets.

@jopfre
jopfre / gist:da6493896bd5fcedd512
Created March 11, 2015 16:37
enable gzip in htaccess
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
@jopfre
jopfre / gist:461b38753b4811c7cc62
Created May 19, 2015 12:54
restart adb so chrome remote debugging recognises android phone
#in cygwin: (your adb path may vary)
cd c:/Program\ Files\ \(x86\)/adt-bundle-windows-x86_64-20140702/sdk/platform-tools
adb devices
@jopfre
jopfre / gist:b8ea1a7ebf39cd8efabb
Last active May 30, 2018 10:34
fix view height support in iOS7 - sass
//based on https://gist.github.com/pburtchaell/e702f441ba9b3f76f587
//with added support for iphone 3 and 4 and orinetation support for iphone 5.
//this is for all devices which can run iOS7 in all orientations.
//not a mixin to avoid to much duplicate code when using on multiple selectors.
.selector {
$height: 70; //set your height in vh
$heightPercent: $height/100;
height: #{$height}vh;
$bpxs: 480px;
$bps: 640px;
$bpm: 768px;
$bpl: 990px;
$bpxl: 1200px;
#change $1.php to whatever extension you wish to remove
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
<!-- demo@ http://jopf.re/squarespirals -->
<textarea cols="30" rows="3">9
6 8 </textarea>
<button>calculate</button>
<p></p>
<script type="text/javascript">
var button = document.getElementsByTagName('button')[0];
var output = document.getElementsByTagName('p')[0];
var input, spiralSize, queryPointNumber, queryCoordiante, center, square, pointNumber, quarterSquare, quarterSquares, dx, dy, direction, squareHTML, queryHTML;
@jopfre
jopfre / .htaccess
Last active October 25, 2018 06:16
force download of files server and client side
#server side force download of files ending with 'download.pdf'
<FilesMatch "download\.pdf$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
@jopfre
jopfre / gist:ffd0153015a791ee25dc14e6cec825f6
Created June 23, 2016 12:52
Add Timestamp to WordPress Child Theme Stylesheet to invalidate cache
function add_timestamp_to_childtheme_stylesheet() {
wp_dequeue_style( 'style' );
wp_deregister_style( 'style' );
wp_enqueue_style('style', get_stylesheet_uri().'?'.filemtime(get_stylesheet_directory().'/style.css'), array(), null);
}
add_action( 'wp_print_styles', 'add_timestamp_to_childtheme_stylesheet' );
@jopfre
jopfre / point-domain-to-different-host.txt
Last active July 7, 2016 14:02
Point a domain from one domain provider (tsohost) to a different host
Set A record for blank (root) to ip
Set A record for www to ip - in tso this is done by selecting the www domain from the drop down
Set MX record to mail.domain-name.com
Set TTL to 300 for all (may only apply to TSO domain providings, ask other providers for their nameservers TTL)