Skip to content

Instantly share code, notes, and snippets.

View nikoloza's full-sized avatar
🌀
symbo.ls

Nika nikoloza

🌀
symbo.ls
View GitHub Profile
@nikoloza
nikoloza / ngCurrencyExchange.js
Last active May 2, 2024 02:29
[Depricated - it's no longer free] Universal currency exchanger in Angular.js using freecurrencyconverterapi.com public API (ES5)
app.service('CurrencyExchange', function($http, $q) {
// using public API for currency exchange rates
return function (from, rates) {
var deferred = $q.defer();
var base = from.toUpperCase();
var currencies = [];
if (typeof rates === 'string') {
currencies = base + '_' + rates.toUpperCase();
@nikoloza
nikoloza / ngRedirectTo.js
Last active March 16, 2016 23:27
Angular ui-router redirectTo trick
// define app
angular.module('app', [])
// listen to state changes
.config(function($rootScope) {
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState) {
// redirectTo
if (toState.redirectTo) {
event.preventDefault();
$state.go(toState.redirectTo, toParams);
@nikoloza
nikoloza / rot17.js
Last active March 15, 2016 03:38
ROT13 variation for Georgian Alphabet.
String.prototype.rot17 = function() {
return this.replace(/[ა-ჱ]/g, function(c) {
c = c.charCodeAt() + 17;
return String.fromCharCode(c <= 4337 ? c : c - 34);
});
};
@nikoloza
nikoloza / grid.less
Last active February 4, 2016 15:10
Generate simple Grid System using Less
.columns(@property: 1) {
& > .cell {
width: 100% / @property;
}
}
.generate-row(@n, @i: 1) when (@i =< @n) {
&.row@{i} {
.columns(@i);
}
@nikoloza
nikoloza / gruntfile.js
Last active June 4, 2016 23:51
Run any command on recently changed file via Grunt
'use strict'
module.exports = function (grunt) {
grunt.initConfig({
options: {
command: 'touch',
args: '',
filepath: '',
file: ''
},
@nikoloza
nikoloza / data-href.html
Last active February 4, 2016 15:17
Making 'href' for any element
<!-- The original idea came from https://github.com/nathanford/data-href -->
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<section>
<p data-href="#/paragraph/url/">