Skip to content

Instantly share code, notes, and snippets.

namespace api
{
namespace blah
{
// Opaque handle to the type this namespace exposes functions for
struct Blah;
// Lifetime management (malloc/free with construct/destruct)
Blah* New(u32 param);
@lopesivan
lopesivan / install_YouCompleteMe_oblitum.md
Last active August 29, 2015 14:16
Instalando YouCompleteMe do oblitum

Fork de YouCompleteMe

YouCompleteMe by oblitum é um fork da versão original com aprimoramentos para programadores C++ e C no Vim.

Sobre Youcompleteme

YouCompleteMe é uma engine para auxiliar o programador a digitar o código no Vim.

Essa versão oficial do plugin YouCompleteMe

Plataforma testada

--- redirect.rb 2012-04-09 11:58:39.905024214 +0300
+++ redirect-pages.rb 2012-04-09 11:58:10.441025135 +0300
@@ -15,9 +15,9 @@
# find all posts with a redirect property and create a new page for each entry
def generate_redirects(site)
- site.posts.select{|x| x.data.key? 'redirects' }.each do |p|
+ (site.pages + site.posts).select{|x| x.data.key? 'redirects' }.each do |p|
p.data['redirects'].each do |r|
- redirect = RedirectPage.new(site, site.source, r, p.id)
@drewsberry
drewsberry / dollars-to-html.py
Created September 18, 2014 15:16
Replace equations $ ... $ or $$ ... $$ with KaTeX HTML using Python
import re
import execjs
def find_equations(string):
""" Take in a string, and convert everything between $ ... $ into an inline
equation and everything between $$ ... $$ into a centred equation. """
doubledollar = re.compile(ur"\$\$([^$]+)\$\$")
singledollar = re.compile(ur"(?<![\$])\$([^$]+)\$(?!\$)")
if (getLangOpts().InterceptAllocationFunctions &&
getLangOpts().RTTI) {
bool UseSize = false;
IdentifierInfo *DeleteInterceptInfo =
&PP.getIdentifierTable().get("__op_delete_intercept__");
DeclareGlobalAllocatorInterceptFunctions(
DeclarationName(DeleteInterceptInfo), UseSize);
LookupResult R(*this, DeleteInterceptInfo, SourceLocation(),
LookupOrdinaryName);
@guyboltonking
guyboltonking / GNUmakefile
Last active December 16, 2015 07:38
Fluent C++; in response to a challenge from Russel Winder's lightning talk at ACCU 2013
all: run-boost-range
run-boost-range: boost-range
./boost-range
boost-range: boost-range.cpp
clang++ -std=c++0x -Iboost_1_53_0 -o boost-range boost-range.cpp
@sdiehl
sdiehl / preamble.hs
Last active February 1, 2016 20:16
Modern Haskell Preamble
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
@nathanleclaire
nathanleclaire / SendingEmailsWithGolang.md
Last active February 24, 2016 19:21
More terse, technical definition of how to send emails using Golang.

Sending emails from Gmail Using Golang

Sending emails from a Gmail account using Go can be done using Go's smtp package. Simply:

  1. Connect to smtp.gmail.com on port 587, authenticating using your email and password
  2. Optionally, use Go's text/template package to format the To, From, Subject, and Body fields of your email
  3. Use smtp's SendMail method to actually send the email

An example usage follows. The SmtpTemplateData struct is used to hold the context for the templating mentioned in (2) above.

#include <stdio.h>
#define TOKENPASTE(x, y) x ## y
#define TOKENPASTE2(x, y) TOKENPASTE(x, y)
#define UNIQUE_FUNC_NAME TOKENPASTE2(cleanuper_func_, __LINE__)
#define UNIQUE_VAR_NAME TOKENPASTE2(cleanuper_var_, __LINE__)
#define SCOPE_EXIT(code_) \
void UNIQUE_FUNC_NAME(int *t __attribute__((unused))) \
code_ \
#include <utility>
#ifndef SCOPE_EXIT_H_
#define SCOPE_EXIT_H_
// modeled slightly after Andrescu’s talk and article(s)
namespace std {
namespace experimental {
template <typename EF> struct scope_exit {
// construction