Skip to content

Instantly share code, notes, and snippets.

View isc30's full-sized avatar
💭
:trollface:

Ivan Sanz Carasa isc30

💭
:trollface:
View GitHub Profile
#include <iostream>
#include <vector>
#include <type_traits>
#include <tuple>
namespace sfinae
{
using success = std::true_type;
using fail = std::false_type;
@isc30
isc30 / ApplyTuppleArrayVector.cpp
Last active January 31, 2018 14:51
C++14 helpers to call functor using args stored in a tuple, array or vector
#include <iostream>
#include <array>
#include <vector>
#include <tuple>
#include <utility>
void printNumbers(int x, int y, int z)
{
std::cout << x << std::endl;
std::cout << y << std::endl;
@isc30
isc30 / Notes for GMock.md
Last active October 15, 2017 14:04
Notes: GMock

Mock const methods

Use MOCK_CONST_*

Mock constructor

Simply call base constructor with custom params

Mock private or protected methods

C++ allows redefining access level on subclasses, so mocks should have everything as PUBLIC

class Loler
@isc30
isc30 / Notes for GUnit.md
Last active October 14, 2017 18:56
Notes: GUnit

Google Test - Unit

Disabling a Test

Add DISABLED_ prefix to test name

Floating point comparisons

Use EXPECT_FLOAT_EQ

Running the tests

main.cpp

#include <gtest/gtest.h>
@isc30
isc30 / extract.js
Last active September 11, 2017 19:49
Extract highlighted text (https://jsfiddle.net/xyh71hjc/16/)
var area = 7;
// BLUE
/*var color = [
0, 220, 220,
35, 255, 255
];*/
// YELLOW
var color = [
@isc30
isc30 / boton.js
Last active September 11, 2017 07:30
!boton
function botonRisk(points)
{
return Math.max(0, (points - 100) * 10 / 50);
}
function boton()
{
$(".composer_rich_textarea").text("!boton");
$(".im_submit_send").trigger('mousedown');
function serializeForm(form)
{
var elems = form[0].elements;
var serialized = [], i, len = elems.length, str = "";
for (i = 0; i < len; i += 1)
{
var element = elems[i];
var type = element.type;
var name = element.name;
@isc30
isc30 / installArsys.bash
Last active July 25, 2016 01:39
Install DnsUpdater for Arsys
#!/bin/bash
if [ "$(whoami)" != "root" ]; then
echo "Run script as ROOT please. (sudo !!)"
exit
fi
apt-get update -y
apt-get install -t stretch -y php7.0-soap
apt-get autoremove -y
@isc30
isc30 / install.bash
Last active January 27, 2021 10:38
Raspberry Pi Install PHP7 + Nginx + MySQL + PhpMyAdmin (last versions)
#!/bin/bash
# Thanks to https://gist.github.com/Lewiscowles1986/ce14296e3f5222082dbaa088ca1954f7
if [ "$(whoami)" != "root" ]; then
echo "Run script as ROOT please. (sudo !!)"
exit
fi
echo "deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi" > /etc/apt/sources.list.d/stretch.list
echo "APT::Default-Release \"jessie\";" > /etc/apt/apt.conf.d/99-default-release