Skip to content

Instantly share code, notes, and snippets.

Adrien Lemaire AdrienLemaire

Block or report user

Report or block AdrienLemaire

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@peterbe
peterbe / base_forms.py
Created Feb 22, 2011
Use these instead of django.forms.Form or django.forms.ModelForm
View base_forms.py
class _BaseForm(object):
def clean(self):
cleaned_data = super(_BaseForm, self).clean()
for field in cleaned_data:
if isinstance(cleaned_data[field], basestring):
cleaned_data[field] = \
cleaned_data[field].replace('\r\n','\n')\
.replace(u'\u2018',"'").replace(u'\u2019',"'").strip()
return cleaned_data
View top3stories.js
// Scraping Made Easy with jQuery and SelectorGadget
// (http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga)
// by David Trejo
//
// Install node.js and npm:
// http://joyeur.com/2010/12/10/installing-node-and-npm/
// Then run
// npm install jsdom jquery http-agent
// node numresults.js
//
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active Apr 8, 2020
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
View node-and-npm-in-30-seconds.sh
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
You can’t perform that action at this time.