Skip to content

Instantly share code, notes, and snippets.

View pedrovanzella's full-sized avatar

Pedro Vanzella pedrovanzella

View GitHub Profile
;;; packages.el --- rtags layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Pedro Vanzella <pedrovanzella@Fenrir.orion>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
class MailController < ApplicationController
def send(e)
begin
UserMailer.email(required_params[:to],
required_params[:from],
required_params[:template],
required_params[:content])
.deliver_now
rescue Exceptions::InvalidTemplateError
render json: {success: false,
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
import os
import ycm_core
from clang_helpers import PrepareClangFlags
compilation_database_folder = ''
# These are the compilation flags that will be used in case there's no
# compilation database set.
flags = [
'-Wall',

Eu tenho algo assim:

wordpress_id: '1'
categories:
- Mondo Bizarro
- abc
tags:
- ciência

Eu preciso de uma regex que pegue todas as categories, isso é, todas as linhas que começam com - após a linha que contém categories:. A única garantia que eu tenho de um fim da lista de categories é uma linha que não começa com - .

Fabricator(:default, from: :connection_profile) do
name_id "default"
name "Perfil Padrão"
conn_type "mobile"
end
@pedrovanzella
pedrovanzella / import_from_octopress.rb
Last active December 15, 2015 14:58
Imports octopress markdown posts into a more standard markdown, prefered by pelican. Also imports images and rewrites the links accordingly.
# encoding: utf-8
#!/usr/bin/env ruby
require 'fileutils'
#
# import_from_octopress.rb
# Imports Jekyll / Octopress formatted blogposts into pelican.
# Author: Pedro Vanzella <pedro@pedrovanzella.com>
#
from microfinance import db
from passlib.hash import bcrypt
from marshmallow import Schema
from marshmallow import post_dump
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(32),
import unittest
from microfinance import app, db
from microfinance.models import User
from sqlalchemy.exc import IntegrityError
class UserTestCase(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgres://localhost/microfinance_test'
@pedrovanzella
pedrovanzella / strip-capture.sh
Created September 4, 2012 01:15
strip-capture.sh
#!/bin/bash
print_usage() {
echo "Usage: $0 <essid> </path/to/capture.cap>"
}
hash tshark &> /dev/null
if [ $? -eq 1 ]; then
echo "This script requires 'tshark', but it does not appear to be installed."
echo "Please install 'tshark', (sudo apt-get install tshark) and try again."