Skip to content

Instantly share code, notes, and snippets.

View gpassarelli's full-sized avatar

Gabriel Passarelli gpassarelli

View GitHub Profile
@gpassarelli
gpassarelli / gist:2135111
Created March 20, 2012 12:58
jQuery: Equalize Heights of Divs
var maxHeight = 0;
$("div").each(function(){
if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});
$("div").height(maxHeight);
@gpassarelli
gpassarelli / gist:2135120
Created March 20, 2012 12:58
jQuery: Plugin Template
(function($){
$.yourPluginName = function(el, radius, options){
// To avoid scope issues, use 'base' instead of 'this'
// to reference this class from internal events and functions.
var base = this;
// Access to jQuery and DOM versions of element
base.$el = $(el);
base.el = el;
@gpassarelli
gpassarelli / gist:2135131
Created March 20, 2012 12:59
jQuery: Display Last Tweet
$.getJSON("http://twitter.com/statuses/user_timeline/username.json?callback=?", function(data) {
$("#twitter").html(data[0].text);
});
@gpassarelli
gpassarelli / gist:2161075
Created March 22, 2012 17:56
CSS: Horizontally Centered List
#centeredmenu {
float:left;
width:100%;
overflow:hidden;
position:relative;
}
#centeredmenu ul {
clear:left;
float:left;
list-style:none;
@gpassarelli
gpassarelli / gist:2175133
Created March 23, 2012 21:16
JavaScript: Show massage before user leave the page
window.onbeforeunload = confirmExit;
function confirmExit()
{
if (needToConfirm)
{
// check to see if any changes to the data entry fields have been made
for (var i = 0; i < values.length; i++)
{
var elem = document.getElementById(ids[i]);
if (elem)
@gpassarelli
gpassarelli / gist:2175169
Created March 23, 2012 21:20
CSS3: Polaroid Image with Rotate
ul.polaroids a {
background: white;
display: inline;
float: left;
margin: 0 0 27px 30px;
width: auto;
padding: 10px 10px 15px;
text-align: center;
font-family: "Marker Felt", sans-serif;
text-decoration: none;
@gpassarelli
gpassarelli / gist:045636d1df3d29bd06b8
Created May 10, 2012 21:01
jQuery: Smooth Scrolling Internal Anchor Links
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
});
@gpassarelli
gpassarelli / gist:5527647
Created May 6, 2013 19:50
Sync files with terminal
rsync -av src/ user@server:dest/
@gpassarelli
gpassarelli / gist:5527659
Created May 6, 2013 19:51
LARAVEL RESTful login app
$credentials = array('username' => $_SERVER['PHP_AUTH_PW'], 'password' => $_SERVER['PHP_AUTH_PW']);
if (Auth::attempt($credentials))
{
return Redirect::to('user/profile');
}
@gpassarelli
gpassarelli / sync_sites
Created January 20, 2015 19:26
Sync sites available with sites enable nginx
#NGINX
ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/myapp
#APACHE
ln -s /etc/apache2/sites-available/myapp /etc/apache2/sites-enabled/myapp