Skip to content

Instantly share code, notes, and snippets.

@Deraen
Deraen / shader_1.py
Created July 6, 2012 17:39
Testing GLSL 1.30
from ctypes import c_void_p
from OpenGL import GL
from OpenGL.GL.shaders import compileShader, compileProgram
from OpenGL.GL.ARB.vertex_array_object import glBindVertexArray, glGenVertexArrays
import pyglet
def glGenVertexArray():
'''
@Deraen
Deraen / app.js
Last active December 17, 2015 12:19
var express = require('./server');
var app = express();
app.get('/cars/:id', function (req, res) {
res.send({id: req.params.id, name: 'Corolla'});
}, {summary: 'Retrieve a car'});
var auth = function (req, res, next) {
next();
};
@Deraen
Deraen / fu.js
Last active December 19, 2015 14:19
Random functions
(function (undefined) {
var _;
if (typeof require === 'function') {
_ = require('lodash');
} else {
_ = window._;
}
var mixins = {};
@Deraen
Deraen / core.clj
Last active December 21, 2015 20:59
Irc foo
(ns deraenircclj.core
(:require [clojure.core.match :refer [match]]
[lamina.core :as c]
[aleph.tcp :as tcp]
[gloss.core :as gloss]
[irclj.parser :refer [parse]]))
(defn create-connection
[]
(let [input (c/permanent-channel)
@Deraen
Deraen / Gruntfile.js
Last active December 23, 2015 12:39
Grunt with Connect proxy
'use strict';
module.exports = function (grunt) {
var path = require('path');
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
var yeomanConfig = {
app: 'app',
dist: 'dist',
port: 3000
};
@Deraen
Deraen / build-package.json
Last active January 16, 2024 19:25
Grunt build script for CI (Jenkins)
# Create build-directory in project and place this package.json in that dir
{
"name": "build",
"version": "0.0.0",
"private": true,
"description": "Grunt-cli & Bower",
"dependencies": {
"grunt-cli": "0.1.11",
"bower": "1.2.8"
},
@Deraen
Deraen / .gitignore
Last active December 26, 2015 01:49
Using A* to find how to sort array using given operations with least operations
node_modules
@Deraen
Deraen / directive-ui-select.js
Created November 18, 2013 14:46
Horrible hack to get ui-select and angular-xeditable to work together
// <span editable-ui-select="building.intentedUsageCode" e-name="intentedUsageCode" e-style="width: 100%" onbeforesave="foo($data)">
// <foo-match>{{$select.selected.code}} {{$select.selected.def}}</foo-match>
// <foo-choices data="item in $usageCodes | filter:$select.search">
// <span ng-bind-html="trustAsHtml((item.code | highlight: $select.search))"></span>
// <span ng-bind-html="trustAsHtml((item.def | highlight: $select.search))"></span>
// </foo-choices>
// <abbr title="{{building.intentedUsageCode}}">{{building.intentedUsageCode | def.usage}}</abbr>
// </span>
angular.module('xeditable')
.directive('editableUiSelect', function(editableDirectiveFactory) {
@Deraen
Deraen / selectize.js
Last active January 1, 2016 06:29
AngularJS Selectize directive (tags)
/*
<input tagcomplete ng-model="skill.tags" options="tags" data-placeholder="Valitse avainsanoja" class="form-control">
Where skill.tags = [{_id: ..., name: 'Something'}, {_id: ..., name: 'Another'}];
...or maybe it is ['Something', 'Another'];
*/
angular.module('frontendApp')
.directive('tagcomplete', function($parse) {
return {
@Deraen
Deraen / autocomplete.js
Last active January 2, 2016 19:29
AngularJS Selectize directive, autocomplete. CHECK https://gist.github.com/Deraen/9811993 FOR BETTER VERSION!
angular.module('frontendApp')
.directive('autocomplete', function($timeout, $compile) {
// No use using ng-model or anything as we are only
// interested in CHANGE EVENTS not about current value
// infact, <autocomplete ng-model="foo"> should work as autocomplete is replaced with input element
// => change-callback is optional
return {
restrict: 'E',
replace: true,