Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Fan of TDD, Vue and Rails

Remigijus Jarmalavičius ReekenX

💻
Fan of TDD, Vue and Rails
View GitHub Profile
@ReekenX
ReekenX / .htaccess
Created Mar 19, 2014
Limit single IP
View .htaccess
<Limit GET POST>
order allow,deny
deny from 200.49.176.139
allow from all
</Limit>
@ReekenX
ReekenX / .htaccess
Created Mar 19, 2014
Cache file extensions
View .htaccess
FileETag MTime Size
<ifmodule mod_expires.c>
<filesmatch "\.(jpg|gif|png|css|js)$">
ExpiresActive on
ExpiresDefault "access plus 1 year"
</filesmatch>
</ifmodule>
View media_queries.css
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
@ReekenX
ReekenX / .htaccess
Created Mar 19, 2014
Custom Error pages
View .htaccess
ErrorDocument 400 /errors/badrequest.html
ErrorDocument 401 /errors/authreqd.html
ErrorDocument 403 /errors/forbid.html
ErrorDocument 404 /errors/notfound.html
ErrorDocument 500 /errors/serverr.html
@ReekenX
ReekenX / .htaccess
Created Mar 19, 2014
Deny access to some files
View .htaccess
<FilesMatch "(install\.sql|config\.php|config\.php\.sample)$">
deny from all
</FilesMatch>
@ReekenX
ReekenX / min_height.css
Created Mar 19, 2014
Min height for all browsers
View min_height.css
#div {
min-height: 500px;
height:auto !important;
height: 500px;
}
@ReekenX
ReekenX / .htaccess
Created Mar 19, 2014
Prevent hotlinking
View .htaccess
RewriteEngine On
#Replace ?mysite\.com/ with your blog url
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your "don't hotlink" image url
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]
@ReekenX
ReekenX / .htaccess
Created Mar 19, 2014
Redirect to maintenance except custom IP's
View .htaccess
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
RewriteRule $ /maintenance.html [R=302,L]
@ReekenX
ReekenX / .htaccess
Created Mar 19, 2014
Universal redirect to www
View .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
@ReekenX
ReekenX / mysql_grant_access.sql
Created Mar 20, 2012
Mysql: Grant access to single database
View mysql_grant_access.sql
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, LOCK TABLES, INDEX ON db_name.* TO db_username@localhost IDENTIFIED BY 'super duper secret password';
You can’t perform that action at this time.