Skip to content

Instantly share code, notes, and snippets.

View voxpelli's full-sized avatar

Pelle Wessman voxpelli

View GitHub Profile
@voxpelli
voxpelli / animateChange.js
Created March 11, 2010 10:42
When an elements dimension changes it looks so much better if that change is animated - this snippet does that for any height changes
var animateChange = function (elem, func, speed) {
var origHeight, goalHeight;
origHeight = elem.innerHeight();
func(elem);
goalHeight = elem.height();
if (origHeight !== goalHeight) {
elem.height(origHeight).animate({height : goalHeight}, speed ? speed : 400, function () {
elem.height('auto');
# Dynamic Virtual Hosts
# get the server name from the Host: header
UseCanonicalName Off
# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot /home/foobar/sites/%-2.0.%-1.0/public_html
# Activate mod_rewrite - which is not recommended!
<Directory /home/foobar/sites/>
@voxpelli
voxpelli / brew_mamp.markdown
Created June 28, 2010 21:37 — forked from hugowetterberg/brew_mamp.markdown
For Brew driven MAMP with Apache2, PHP 5.3 and MySQL 5.1

For Brew driven MAMP with Apache2, PHP 5.3 and MySQL 5.1

If you've MacPorts install - you probably should move it to avoid any unintentional conflicts.

Install brew (assuming that you have Xcode installed).

$ ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"

Install git and bash completion. (Perhaps by first following gem instructions at http://wiki.github.com/mxcl/homebrew/gems-eggs-and-perl-modules)

Apps

<?php
$provider = new stdClass;
$provider->disabled = FALSE; /* Edit this to true to make a default provider disabled initially */
$provider->name = 'linkedin';
$provider->title = 'LinkedIn';
$provider->url = 'https://api.linkedin.com';
$provider->consumer_advanced = array(
'signature method' => 'HMAC-SHA1',
'authentication realm' => '',
'request token endpoint' => '/uas/oauth/requestToken',
<?php
$provider = new stdClass;
$provider->disabled = FALSE; /* Edit this to true to make a default provider disabled initially */
$provider->name = 'twitter';
$provider->title = 'Twitter';
$provider->url = 'http://api.twitter.com';
$provider->consumer_advanced = array(
'signature method' => 'HMAC-SHA1',
'request token endpoint' => '/oauth/request_token',
'authorization endpoint' => '/oauth/authenticate',
<?php
function feeds_do($name) {
if (environment_allowed($name, 'feeds', TRUE)) {
// Do the dance
}
}
feeds_do('Heavy Import');
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<style>
ul {
overflow: hidden;
width: 150px;
height: 70px;
@voxpelli
voxpelli / gist:628712
Created October 15, 2010 18:43
Git command for listing remote branches that you haven't merged
git branch -a --no-merged

Use the post-receive in a repo on eg. your testing or production server. Create a git-repo on the server for the code you want to run there and add it as a remote to your local checkout of your project repo. Whenever you want to deploy you push to the git repo on the server and with the below script as the post-receive hook on the project the server will automatically update with the new code.

Originally described in a now probably slightly outdated blog post: http://blogs.goodold.se/tech/2009/06/26/git-workflow-going-live/

To use this hook the git repository on the server should have another branch than its master branch checked out. The git repo on the server can be an entirely new one and doesn't have to be a checkout of your project repo. Creating an entirely new repo involves some fiddling with temporary commits and force pushing though - nothing complicated, but perhaps not something that everyone is used to be doing.