This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
#include <iostream> | |
using namespace std; | |
struct objT | |
{ | |
}; | |
struct a : objT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename Type, typename Tuple, int level = -30> | |
struct get_type_pos | |
{ | |
typedef typename tuple_element<level, Tuple>::type selected_type; | |
static constexpr bool same = is_same<selected_type, Type>::value; | |
static int Get() | |
{ | |
return GetA<int>(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <type_traits> | |
template<int wished_size> | |
struct filler | |
{ | |
static const int word_size = sizeof(int); | |
static const int actual_size_in_words = (wished_size + word_size - 1) / word_size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Warning! You lose all constraight's | |
// All depended views NOT updating | |
function AddColumnPos( $table_name, $pos, $name, $data_type ) | |
{ | |
db::Query("BEGIN"); | |
db::Query("LOCK TABLE {$table_name} IN ACCESS EXCLUSIVE MODE"); | |
db::Query("SET CONSTRAINTS ALL DEFERRED"); | |
$cols = db::Query("SELECT column_name as name, data_type as type FROM information_schema.columns WHERE table_name='{$table_name}'"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// http://www.youlikeprogramming.com/2013/01/interfacing-postgresqls-hstore-with-php/ | |
function pgArrayToPhp($text) | |
{ | |
if(is_null($text)) | |
return []; | |
if(!is_string($text) && $text == '{}') | |
return []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function HookObject(hook, depth) | |
{ | |
var k, fn; | |
if (typeof depth === 'undefined') | |
depth = -1; | |
// https://gist.github.com/Enelar/34f9ef9ee412cb88beb4 | |
var _CloneObject = CloneObject; | |
function Helper(name, fn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CloneObject(obj) | |
{ | |
if (obj === null) | |
return obj; | |
if (typeof obj !== "object") | |
return obj; | |
var copy = obj.constructor(); | |
for (var attr in obj) | |
if (obj.hasOwnProperty(attr)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Introduced by Scott Schurr in "C++ Now! 2012" | |
class constexpr_string | |
{ | |
protected: | |
const char* const p; | |
const std::size_t s; | |
public: | |
template<std::size_t N> | |
constexpr constexpr_string(const char(&a)[N]) | |
: p(a), s(N-1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.686 | |
.model flat | |
.stack | |
data segment "data" | |
data ends | |
.CODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# http://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux | |
RED='\033[0;31m' | |
NC='\033[0m' # No Color | |
printf "${RED}Check&install required utility${NC}\n" | |
rpmqa=`rpm -qa` | |
echo $rpmqa | grep -qw lynx || sudo yum install lynx | |
echo $rpmqa | grep -qw wget || sudo yum install wget |
OlderNewer