Skip to content

Instantly share code, notes, and snippets.

View PoisonousJohn's full-sized avatar

Ivan Fateev PoisonousJohn

View GitHub Profile
<?php
namespace WSL\BaseBundle\Util\Helper;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Security\Acl\Permission\MaskBuilder;
/*
* To change this template, choose Tools | Templates
/**
* source : http://snipplr.com/view/22741/slugify-a-string-in-php/
*
* @static
* @param $text
* @return mixed|string
*/
static public function slugify($text)
{
// replace non letter or digits by -
varying lowp vec4 DestinationColor; // 1
void main(void) { // 2
gl_FragColor = DestinationColor; // 3
}
@PoisonousJohn
PoisonousJohn / gist:4339608
Created December 19, 2012 19:16
If I pass Vertex structure to shader attribute then it works, but if I'm passing one dimensional array, then it doesn't work
typedef struct {
float Position[3];
float Color[4];
} Vertex;
const Vertex Vertices[] = {
{{1, -1, -7}, {1, 0, 0, 1}},
{{1, 1, -7}, {0, 1, 0, 1}},
{{-1, 1, -7}, {0, 0, 1, 1}},
{{-1, -1, -7}, {0, 0, 0, 1}}
@PoisonousJohn
PoisonousJohn / CCSpriteHue.h
Last active December 11, 2015 06:59
Hue shader
//
// Created by JohnPoison <[email protected]> on 1/17/13.
#import <Foundation/Foundation.h>
#import "CCSprite.h"
@interface CCSpriteHue : CCSprite {
Ther is a class
class Boo : public SuperBoo {
Foo* fFoo1;
Foo* fFoo2;
// ...
}
where foo is a monomorphic class, and Boo owns pointers fFoo1 and fFoo2
task: overload operator= for Boo
that's all >_<
#!/usr/bin/env ruby
#
# hiero2sparrow.rb
# Sparrow
#
# Created by Daniel Sperl on 11.02.2010
# Copyright 2010 Incognitek. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
@PoisonousJohn
PoisonousJohn / main.cpp
Created January 15, 2014 17:20
snippet for time profiling
#include <iostream>
#include <chrono>
int main()
{
auto t1 = std::chrono::high_resolution_clock::now(); //Used in testing execution duration.
auto t2 = std::chrono::high_resolution_clock::now();
std::cout << "test function took "
<< std::chrono::duration_cast<std::chrono::nanoseconds>(t2 - t1).count()
export NDK=/tmp/android-ndk-r8b
# Create the standalone toolchain
$NDK/build/tools/make-standalone-toolchain.sh \
--platform=android-9 \
--install-dir=/tmp/my-android-toolchain
export PATH=/tmp/my-android-toolchain/bin:$PATH
export SYSROOT=/tmp/my-android-toolchain/sysroot
export CC="arm-linux-androideabi-gcc --sysroot $SYSROOT"
#include <iostream>
#include <unordered_map>
#include <string>
#include <assert.h>
using namespace std;
class ServiceInterface {
public:
virtual ~ServiceInterface() {}