Skip to content

Instantly share code, notes, and snippets.

View ox's full-sized avatar
👹
what is this, AIM?

Artem Titoulenko ox

👹
what is this, AIM?
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ox on github.
  • I am ofxartem (https://keybase.io/ofxartem) on keybase.
  • I have a public key whose fingerprint is 03BB 8C0D B263 C8E5 D7C1 5958 0C0B EFBB E65D C950

To claim this, I am signing this object:

@ox
ox / script.js
Last active August 29, 2015 14:01
(function () {
alert('HJAHHA')
})()
@ox
ox / index.html
Created May 19, 2014 05:09
A gist demonstrating cndizer's inability to correctly cdnify multiple angular components installed with bower.
<html>
<head></head>
<body>
<script type="text/javascript" src="/components/angular/angular.js"></script>
<script type="text/javascript" src="/components/angular-route/angular-route.js"></script>
<script type="text/javascript" src="/components/angular-resource/angular-resource.js"></script>
<script type="text/javascript" src="/components/angular-cookies/angular-cookies.js"></script>
<script type="text/javascript" src="/components/angular-sanitize/angular-sanitize.js"></script>
</body>
</html>
@ox
ox / replace.js
Created February 3, 2014 17:57
angular filter that replaces a suffix with another
// replace the file pointed at
angular.module('vendorApp')
.filter('replace', function () {
'use strict';
// check if str ends with suffix
function endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
@ox
ox / main.c
Last active December 31, 2015 18:49
N to the power K using optimized tail recursion
#include <stdio.h>
#include <stdlib.h>
double long npowerk(double long n, double long k) {
if (k == 0) {
return 1;
}
double long total = n;
@ox
ox / index.html
Created December 11, 2013 06:11
Basic ToDo app in Angular. this is awful code
<!doctype html>
<html ng-app="todo">
<head>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
</head>
<body>
<div class="container" ng-controller="TodoController as todoctrl">
<div class="row">
<h1>Todos</h1>
require "mkmf"
extension_name = "TagLibArtem"
taglib_config = find_executable("taglib-config")
if taglib_config
prefix = `#{taglib_config} --prefix`.strip
$CFLAGS += " -I#{prefix}/include"
$LDFLAGS += " -L#{prefix}/lib"
else
@ox
ox / bundle.js
Created October 1, 2013 05:23
Take an array of numbers and returns an array of groups of identical numbers. [2, 1, 2] would return [[1], [2, 2]].
var k = [1,4,2,5,3,2,2,5,7,8,8,5,3,4,4,4,2,1]
function bundle(arr) {
var t = {}
arr.map(function (x) {
if (!t[x]) t[x] = []
t[x].push(x)
})
return Object.keys(t).reduce(function (memo, x) { return memo.concat([t[x]])}, [])
}
var k = [1,4,2,5,3,2,2,5,7,8,8,5,3,4,4,4,2,1]
function bundle(arr) {
var t = {}
arr.map(function (x) {
if (!t[x]) t[x] = []
t[x].push(x)
})
return Object.keys(t).reduce(function (memo, x) { return memo.concat([t[x]])}, [])
}
The polar opinions on various databases always crack me up. If you ask a programmer about a given database they'll either love it for solving all of their problems or hate it for causing them. Most of the time the issue is actually caused by the way the programmer decided to originally model their data. This is a proposal for a program that will automatically handle the way associations are stored in a key-value store and hopefully end some of the mindless debates about how #webscale your favorite #noSQL DB is.
Example Schema
Throughout this article I’ll use the below schema for a user as an example:
{
id: String,
name: String,
friends: [User]
}