Skip to content

Instantly share code, notes, and snippets.

@phstc
phstc / test_mijoes.html
Created February 15, 2011 18:49
Coding Dojo de Python no Google SP 10/02/2011 / Versão em Javascript.
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css" type="text/css" media="screen" />
<!--
Problema: Mijões
Objetivo dados X mictórios e Y mijões, retorne um array contendo VAZIO e MIJAO.
Sendo que os mijões devem ser alocados de forma mais distante possível.
@phstc
phstc / .bash_profile
Created July 20, 2011 22:40
My .bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
alias ls="ls -G"
alias wget="curl -O"
# alias vim="/Applications/MacVim-7_3-53/mvim"
# MacPorts Installer addition on 2009-07-28_at_13:27:49: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
@phstc
phstc / gist:1989083
Created March 6, 2012 21:34 — forked from willnet/gist:1703102
install manual of swfmill on mac
# http://download.savannah.gnu.org/releases/freetype/ から最新のfreetypeをダウンロード
tar zxvf freetype-x.x.x
cd freetype
./configure
make
sudo make install
curl -O http://www.swfmill.org/releases/swfmill-0.3.2.tar.gz
tar zxvf swfmill-0.3.2.tar.gz
cd swfmill-0.3.2
@phstc
phstc / rails31init.md
Created March 8, 2012 12:52 — forked from samnang/rails31init.md
Rails 3.1 with Rspec, Factory Girl, Haml, Simple Form, Database Cleaner, Spork, and Guard

Install Rails 3.1

gem install rails

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

@phstc
phstc / friendly_urls.markdown
Created March 24, 2012 22:36 — forked from jcasimir/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.

@phstc
phstc / mia_eating.ino
Created May 7, 2012 15:39
It's an Arduino experiment to count how many times Mia (my cat) eats per day, if she eats more on the week or weekend when we are at home. http://f.cl.ly/items/3E3Q3p2x2S132e1T2332/Image%202012.10.27%201:05:59%20PM.png
#include "Ultrasonic.h"
#include <SD.h>
Ultrasonic ultrasonic(7,6);
File file;
boolean eating = false;
int hour = 23;
@phstc
phstc / gist:2800735
Created May 27, 2012 03:18
brew install -v imagemagick 2>&1
==> Downloading http://downloads.sf.net/project/machomebrew/mirror/ImageMagick-6.7.5-7.tar.bz2
Already downloaded: /Library/Caches/Homebrew/imagemagick-6.7.5-7.tar.bz2
/usr/bin/tar xf /Library/Caches/Homebrew/imagemagick-6.7.5-7.tar.bz2
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
patching file configure
==> ./configure --disable-osx-universal-binary --without-perl --prefix=/usr/local/Cellar/imagemagick/6.7.5-7 --disable-dependency-tracking --enable-shared --disable-static --with-modules --without-gslib --with-gs-font-dir=/usr/local/share/ghostscript/fonts --without-magick-plus-plus
./configure --disable-osx-universal-binary --without-perl --prefix=/usr/local/Cellar/imagemagick/6.7.5-7 --disable-dependency-tracking --enable-shared --disable-static --with-modules --without-gslib --with-gs-font-dir=/usr/local/share/ghostscript/fonts --without-magick-plus-plus
configuring ImageMagick 6.7.5-7
checking build system type... x86_64-apple-darwin11.4.0
@phstc
phstc / gist:2800819
Created May 27, 2012 03:19
brew doctor
Error: You have uncommitted modifications to Homebrew's core.
Unless you know what you are doing, you should run:
cd /usr/local && git reset --hard
Error: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
git
@phstc
phstc / gist:2800859
Created May 27, 2012 03:20
brew --config
HOMEBREW_VERSION: 0.9
HEAD: 49f5f37ca37ee49008fb3aecb7095c29a211de5d
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: dual-core 64-bit penryn
OS X: 10.7.4
Kernel Architecture: x86_64
Xcode: 4.3.2
GCC-4.0: N/A
GCC-4.2: N/A
@phstc
phstc / gist:2800877
Created May 27, 2012 03:20
cat ~/Library/Logs/Homebrew/config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by ImageMagick configure 6.7.5-7, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure --disable-osx-universal-binary --without-perl --prefix=/usr/local/Cellar/imagemagick/6.7.5-7 --disable-dependency-tracking --enable-shared --disable-static --with-modules --without-gslib --with-gs-font-dir=/usr/local/share/ghostscript/fonts --without-magick-plus-plus
## --------- ##
## Platform. ##