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');
@rexzj266
rexzj266 / NewFile.py
Created October 29, 2015 01:45 — forked from finscn/NewFile.py
A plugin of SublimeText 3 : Let the FOLDER of a new untitled file be as same as the folder of current activated file.
# NewFileAtCurrentFolder
import sublime_plugin
import os.path
class NewFileListener(sublime_plugin.EventListener):
def on_new_async(self, view):
if not view.window().active_view():
print("NF: no view")
return
@rexzj266
rexzj266 / 0_reuse_code.js
Created October 27, 2015 01:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
{
"bold_folder_labels": true,
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"default_line_ending": "unix",
"fade_fold_buttons": false,
"fallback_encoding": "Shift_JIS",
"font_options": "subpixel_antialias",
"font_size": 10,
"format_on_save": true,
"gutter": true,
//
// 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