Skip to content

Instantly share code, notes, and snippets.

import Ember from 'ember';
export default Ember.Component.extend({
willInsertElement() {
console.log("willInsertElement", this.get('name'));
},
didInsertElement() {
console.log("didInsertElement", this.get('name'));
}
});
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
const { Helper, inject, get } = Ember;
/* stolen from Ember.LinkComponent */
export default Helper.extend({
_routing: inject.service('-routing'),
compute([qualifiedRouteName, ...models], queryParams) {
let routing = get(this, '_routing');
@KoKuToru
KoKuToru / udf_wkb_union.cpp
Last active January 8, 2016 14:53
MYSQL AGGREGATE UDF FOR UNION GEOMETRIES (USING WKB)
// g++ -shared -o /tmp/test.so -I/usr/include/mysql /tmp/tmp.cpp -fPIC -lgeos -rdynamic
//CREATE AGGREGATE FUNCTION udf_wkb_union RETURNS STRING SONAME 'udf_wkb_union.so';
//SELECT GeomFromWKB(udf_wkb_union(AsWKB(SHAPE))) FROM new_table;
#ifdef STANDARD
#include <stdio.h>
#include <string.h>
#ifdef __WIN__
@KoKuToru
KoKuToru / application.template.hbs
Last active September 24, 2015 16:10
Loading Problem
<h1>application/template.hbs</h1>
{{#link-to 'index'}} index {{/link-to}}
{{#link-to 'test'}} test {{/link-to}}
{{#link-to 'test.subtest'}} subtest {{/link-to}}
<br>
{{outlet}}
i686-w64-mingw32-cmake ..
make
#zip everything
mkdir gtox-win32
#Copy everything we need
cp -rT /usr/i686-w64-mingw32 ./gtox-win32
cp -r ./share ./gtox-win32/
cp gtox.exe ./gtox-win32/bin/gtox.exe
@KoKuToru
KoKuToru / gist:629bd90d5d6ee9a47864
Last active August 29, 2015 14:21
ANDROID SQL OH THANKS
Stack<Character> stack = new Stack<>();
int last_split = 0;
boolean ignore_next = false;
for(int i = 0; i < full_cmd.length(); ++i) {
if (ignore_next){
ignore_next = false;
continue;
}
char c = full_cmd.charAt(i);
if (c == ']') {
@KoKuToru
KoKuToru / GearRender.js
Last active August 29, 2015 14:14
Simple gear rendering.
//Luca Béla Palkovics 27.01.2014 - Luca.Bela.Palkovics@gmail.com
/*
Renders gears in Canvas
Copy & Past into http://htmlivecode.com/canvas-animation-playground/
*/
function gear(ctx, settings) {
var acc = 10;
if (typeof settings.cache === "undefined") {
settings.cache = {};
@KoKuToru
KoKuToru / gist:1d23af4bbf0b2bc89893
Created January 2, 2015 13:33
Efficient Sum and Assignment operator overloading in C++
/**
* Delayed add,sub,mul,div of a Matrix
* mul,div is by element. Not a real Matrix mul,div !
*
* Just shows the idea of delaying calculations..
*/
//Should never be used outside, is a helper class
class MatAccess {
public:
@KoKuToru
KoKuToru / gist:460cfffecd89d73cd376
Created December 17, 2014 17:33
CDynamicStruct
#ifndef CDYNAMICSTRUCT
#define CDYNAMICSTRUCT
#pragma GCC push_options
#pragma GCC optimize (3)
#include <iostream>
#include <type_traits>
#include <string>
#include <vector>