Skip to content

Instantly share code, notes, and snippets.

@paulredmond
paulredmond / git-hg-rosetta-stone.md
Last active Aug 29, 2015
Git / Mercurial Rosetta Stone
View git-hg-rosetta-stone.md

Note: this is from the sympy/sympy wiki

The sympy git server is at https://github.com/sympy/sympy . The main Sympy repository may be cloned with "git clone git://github.com/sympy/sympy.git".

The first and the most important thing is that you should understand that git is '''different'''. For example it uses staging area (so called index) for iteratively preparing commits. This and other great and unique features of git make it the preference of many developers, so go read its documentation - you would not regret!

View sprocketize.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'Sprockets'
require 'Jsmin'
MINFILE = 'app/webroot/js/build-min.js'
CONCATFILE = 'app/webroot/js/concat.js'
secretary = Sprockets::Secretary.new(
:asset_root => 'app/webroot',
@paulredmond
paulredmond / remove-containers-before.sh
Created Sep 12, 2015
Remove all Docker containers with --before flag
View remove-containers-before.sh
docker rm $(docker ps -a --before 97b0b463468f | awk '{if (NR!=1) {print $1}}')
View plugin_route.php
<?php
/**
* PluginRoute class.
*
* Route class for plugins that allows you to clean up urls for plugins
* without tons of calls to Router::connect() to shorten controller names in urls.
*/
class PluginRoute extends CakeRoute
{
View PHP Capistrano Recipe.rb
# --------------------------------------------
# General
# --------------------------------------------
set :shared_children, %w(cache logs) # Shared directories, these directories contain generated content which should not be wiped out during deployments.
set :application, "domain.com" # Application name
set :deploy_to, "/var/www/#{application}/#{stage}" # Path where files are deployed to ...
# --------------------------------------------
# Server
# --------------------------------------------
View php.rb
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
class Php <Formula
url 'http://www.php.net/get/php-5.3.3.tar.gz/from/this/mirror'
homepage 'http://php.net/'
md5 '5adf1a537895c2ec933fddd48e78d8a2'
View PHP 5.3.3 Brew Recipe
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
class Php <Formula
url 'http://www.php.net/get/php-5.3.3.tar.gz/from/this/mirror'
homepage 'http://php.net/'
md5 '5adf1a537895c2ec933fddd48e78d8a2'
View phpdoc.sh
# Run from the terminal to generate phpdocumentor files
phpdoc -d ~/path/to/app -t ~/path/to/place/docs -ti 'Documentation Title' -dn 'defaultpackage'
View connect_login.html
<!-- broken -->
<a href="#" class="connect-login">
<img src="http://media.sheknows.com/dares/ui/connect_sign_in.png" alt="Sheknows Connect">
</a>
<!-- :) -->
<a href="#" class="connect-login" data-redirect="/dares">
<img src="http://media.sheknows.com/dares/ui/connect_sign_in.png" alt="Sheknows Connect">
</a>
View fix-smarty.php
<?php
$dir = new RecursiveDirectoryIterator(dirname(__FILE__));
$iterator = new RecursiveIteratorIterator($dir);
$pattern = '~\{(.+?)\}~im';
$start_char = '{';
$end_char = '}';