Skip to content

Instantly share code, notes, and snippets.

@DCoderLT
DCoderLT / gist:4420192
Last active December 10, 2015 10:19 — forked from anonymous/gist:4420137
<?php
// In the app configuration:
'components' => array(
'db' => array(
'enableParamLogging' => true, // self explanatory
),
'log' => array(
'routes' => array(
@DCoderLT
DCoderLT / vectors.cpp
Created November 24, 2012 13:22
Possible solution for SO question #13541243
#include <vector>
#include <numeric>
#include <functional>
template<typename T>
std::vector<T> compact(const std::vector<T> &input, int stride, std::function<T(T, T)> op) {
std::vector<T> output(stride);
unsigned int index = 0;
return std::accumulate(input.begin(), input.end(), output, [&index, stride, op](std::vector<T> &acc, T elem) -> std::vector<T> {
acc[index % stride] = op(acc[index % stride], elem);
@DCoderLT
DCoderLT / uninit.c
Created September 23, 2012 07:50
G++ missing warning
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b;
float f, g = 1;
if(rand() < 0.5) {
b = 0;
} else {
@DCoderLT
DCoderLT / gist:2430454
Created April 20, 2012 17:26
MSVC version of the two functions
; http://stackoverflow.com/questions/10250419/why-does-gcc-generate-such-radically-different-assembly-for-nearly-the-same-c-co
PUBLIC ?fast_trunc_one@@YAHH@Z ; fast_trunc_one
; Function compile flags: /Ogtpy
_TEXT SEGMENT
_i$ = 8 ; size = 4
?fast_trunc_one@@YAHH@Z PROC ; fast_trunc_one
; File c:\program files (x86)\microsoft visual studio 10.0\vc\bin\c2.cpp
; Line 6
mov eax, DWORD PTR _i$[esp-4]
push esi