Skip to content

Instantly share code, notes, and snippets.

@sangar82
sangar82 / htaccess_301_redirect_new_domain
Created January 22, 2013 07:46
.htacess snippet - Redirect with the query string all the pages with 301 redirection to new domain and redirects
RewriteEngine On
RewriteCond %{HTTP_HOST} ^old_domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.old_domain.com$
RewriteRule (.*)$ http://www.new_domain.com/$1 [R=301,L]
@sangar82
sangar82 / IEtransparency
Last active December 12, 2015 06:38
background filter for IE
//CONVERSION TO ARGB
http://kilianvalkhof.com/2010/css-xhtml/how-to-use-rgba-in-ie/
.ie_transparency{
background:transparent;
-ms-filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#BF000000,endColorstr=#BF000000);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#BF000000,endColorstr=#BF000000);
zoom: 1;
}
@sangar82
sangar82 / gist:5253176
Created March 27, 2013 10:12
Open folder with sublime text 2 from termnial
sudo ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /bin/subl
subl .
@sangar82
sangar82 / window.postMessage
Last active December 16, 2015 03:29
window.postMessage is a method for safely enabling cross-origin communication. Normally, scripts on different pages are only allowed to access each other if and only if the pages which executed them are at locations with the same protocol (usually both http), port number (80 being the default for http), and host (modulo document.domain being set…
Domain A with iframe:
-----------------------
<iframe></iframe>
<script>
window.addEventListener( "message",
function (e) {
if(e.origin !== 'http://www.domainB.com'){ return; }
alert(e.data);
},
false);
@sangar82
sangar82 / gist:5442092
Created April 23, 2013 09:19
Get lat,lng from googleapis from PHP
$direccion = "put here the adress";
$resultado = json_decode(file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?address=".urlencode($direccion)."&sensor=false"));
echo $resultado->results["0"]->geometry->location->lat;
echo $resultado->results["0"]->geometry->location->lng;
@sangar82
sangar82 / gist:5589974
Created May 16, 2013 07:18
Laravel 4 Dropdown for BD
<?php $types = Type::lists('name', 'id'); ?>
{{ Form::select('select', $types) }}
@sangar82
sangar82 / gist:6775001
Last active December 24, 2015 09:09
Laravel + Vagrant + Sublime Text 2 + XDEBUG
Info xdebug martomo plugin
https://github.com/martomo/SublimeTextXdebug/issues/39
php.ini.erb (vagrant)
<% if use_xdebug != "0" %>
[xdebug]
xdebug.remote_enable=1
xdebug.remote_port=9001
@sangar82
sangar82 / gist:8416855
Created January 14, 2014 11:26
create facebook tab for page
Create app on developers.facebook.com
https://www.facebook.com/dialog/pagetab?next=http://facebook.com&app_id=AppID
http://beto.valdeszorrilla.mx/como-crear-pestanas-facebook-apps-para-paginas-de-facebook-paso-a-paso/
#!/bin/sh
#
# This hook does two things:
#
# 1. update the "info" files that allow the list of references to be
# queries over dumb transports such as http
#
# 2. if this repository looks like it is a non-bare repository, and
# the checked-out branch is pushed to, then update the working copy.
# This makes "push" function somewhat similarly to darcs and bzr.
@sangar82
sangar82 / gist:9597499
Created March 17, 2014 11:10
Flush DNS OSX Mavericks
dscacheutil -flushcache
sudo killall -HUP mDNSResponder