Skip to content

Instantly share code, notes, and snippets.

@MarZab
MarZab / WiseTimetableToiCalendarConverter.php
Last active October 11, 2015 23:47
Wise Timetable to iCalendar Converter
<?php
/*
* Wise Timetable to vCalendar Converter
* @Author Marko Zabreznik
* @copyright Marko Zabreznik
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM,
// SCSS for https://github.com/mbenford/ngTagsInput/
// Marko Zabreznik 4.2.2014
.ngTagsInput {
* {
@include box-sizing(border-box);
&:before, &:after {
@include box-sizing(border-box);
}
/*
* angular-ubilabs-geocomplete
* (c) 2014 Marko Zabreznik http://zabreznik.net
* License: MIT
*/
/*
* What is it: a simple factory that lazy loads google geo maps and ubilabs jquery.geocomplete.js
*
* You need: Angular, jQuery and Underscore
@MarZab
MarZab / gist:a65e0d03fa3c984aa662
Created July 4, 2014 14:43
Better logs on Node.js Express.js +Passport.js +Heroku
// create a new token to track logged in users
express.logger.token('user', function(req, res){
// req.user is the deault passport.js variable, log the user id
return req.user ? req.user._id : '-';
});
// use this function on Heroku to get the remote IP
express.logger.token('ip', function(req, res){
@MarZab
MarZab / tooltip.js
Created August 5, 2014 09:19
my take on popup tool-tips title replacements with Angular.js
/*
Why include huge tooltip libraries when something like this does the job perfectly
*/
app.directive('tooltip', [function () {
return { link: function (scope, element, attr) {
// use tag's title text for a popup
element
.addClass('tooltip-wrap')
.append(angular.element('<div class="tooltip-text">'+attr.title+'</div>'))
.attr('title', null);
@MarZab
MarZab / Gruntfile.js
Last active May 20, 2017 18:23
comments for npm package.json with a grunt.js task
/*jslint node: true */
'use strict';
module.exports = function (grunt) {
/*
1. make package.json.js and export the json that will be saved as package.json
2. run grunt package.json, the new file will be written and you get a patch as well
*/
grunt.registerTask('package.json', function () {
@MarZab
MarZab / form.json
Created February 5, 2015 20:21
angular-schema-form + ngStrap Select
form: [
{
"key": "wizzard",
"type": "strap-select"
},
]
@MarZab
MarZab / gist:a582488418f730657fa6
Last active August 29, 2015 14:16
Disable WordPress Feed Comments
<?php
/*
Plugin Name: Disable Feed Comments
Description: Disable commenting, comment feeds
Author: Marko Zabreznik
Version: 0.1
Author URI: http://zabreznik.net
*/
// if a comments template is requested, quit
@MarZab
MarZab / gist:fff319b893d3209c7eba
Created March 27, 2015 22:44
Statistics of WordPress locale usage per capita (native speakers); data from translate.wordpress.org and WikiPedia
Locale Release Pack Total Native speak. Total per NS
en 17037257 — 17037257 360 0.04732571389
nb_NO 55975 101078 157053 5 0.03141060000
nl_NL 444729 44564 489293 22 0.02224059091
sv_SE 151115 9325 160440 9.2 0.01743913043
fr_FR 1038957 237164 1276121 75 0.01701494667
de_DE 1080555 415812 1496367 89 0.01681311236
sk_SK 25968 52657 78625 5.2 0.01512019231
fa_IR 829918 55124 885042 60 0.01475070000
sl_SI 13247 22763 36010 2.5 0.01440400000
@MarZab
MarZab / ngrams.js
Created April 13, 2015 09:08
JavaScript Implementation of N-Gram Text Categorisation based on paper by William B. Cavnar and John M. Trenkle
'use strict';
/*
N-Gram-Based Text Categorisation
Implementation by [email protected]
28.3.2015 All rights reserved.
Based on the paper by:
William B. Cavnar and John M. Trenkle
Environmental Research Institute of Michigan