Skip to content

Instantly share code, notes, and snippets.

@rexzj266
rexzj266 / beautiful_idiomatic_python.md
Created December 9, 2020 07:23 — forked from 0x4D31/beautiful_idiomatic_python.md
[Beautiful Idiomatic Python] Transforming Code into Beautiful, Idiomatic Python #python

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@rexzj266
rexzj266 / git-info.md
Last active November 13, 2019 09:26 — forked from hofmannsven/README.md
Git Cheatsheet
@rexzj266
rexzj266 / mongoose-cheatsheet.md
Created April 6, 2016 07:18
mongoose cheatsheet

Definitely not comprehensive. This is meant to be a basic memory aid with links to get more details. I'll add to it over time.

Install

$ npm install mongoose --save

Connect

const mongoose = require('mongoose');
//
// CRUD API for RESTful services with URLs similar 'http://services.mysite.com/classes/Book'.
//
// e.g. parse.get(
// "Book",
// 123,
// function(response){ console.log(response.toString());}
// );
//
services.factory('parse', function($rootScope, $http) {
@rexzj266
rexzj266 / app.js
Created September 25, 2013 14:52 — forked from pixelhandler/app.js
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
@rexzj266
rexzj266 / app.js
Created August 23, 2013 03:45 — forked from madhums/app.js
var express = require('express');
var app = express.createServer();
require('./settings').boot(app);
app.dynamicHelpers({
base: function(){
// return the app's mount-point
// so that urls can adjust. For example
// if you run this example /post/add works
// 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
//
var mongoose = require('mongoose');
mongoose.connect('localhost', 'testing_populatedGetter');
var Schema = mongoose.Schema;
var UserSchema = new Schema({
name: {
first: {
type: String
},
# Vagrant commands
vagrant reload #!
vagrant status
vagrant suspend
vagrant resume
vagrant halt
vagrant up
vagrant package
vagrant destroy
vagrant box add <nombre> <url>