Skip to content

Instantly share code, notes, and snippets.

@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>
<!-- 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;
#change $1.php to whatever extension you wish to remove
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
$bpxs: 480px;
$bps: 640px;
$bpm: 768px;
$bpl: 990px;
$bpxl: 1200px;
@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;
@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: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