Skip to content

Instantly share code, notes, and snippets.

// Backbone.Wreqr (Backbone.Marionette)
// ----------------------------------
// v1.3.1
//
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
// Distributed under MIT license
//
// http://github.com/marionettejs/backbone.wreqr
var assert = require('assert');
var check = function(num) {
var numStr = String(num);
var length = numStr.length / 2;
for(var i = 0; i <= length; i++) {
if (numStr[i] != numStr[numStr.length - i - 1]) {
return false;
}
}
@kharandziuk
kharandziuk / gist:c11beb0a826a1ec225f1
Created June 12, 2015 11:37
Playbook. Installs MongoDB 3.* with ansible
- name: Machine with mongodb 3
hosts: all
sudo: True
tasks:
- name: set locale
lineinfile: dest=/etc/default/locale line="LC_ALL=C"
- name: Add mongo ppa key
apt_key: >
keyserver=hkp://keyserver.ubuntu.com:80
from django.core.management.base import BaseCommand
from core import choices, models, utils
MARKER = 'test_data'
class Command(BaseCommand):
args = 'filename'
def rotations(num):
str_num = str(num)
result = set()
for mid in xrange(len(str_num)):
result.add(
str_num[mid:] + str_num[:mid]
)
return result
.phony: check
check1:
curl -v http://develop.cricketduel.inprogress.rocks/
check2:
curl -i http://develop.cricketduel.inprogress.rocks/
t:
class N
constructor: (val, next) ->
@val = val
@next = next
assert = require('assert')
reverse = (node, prev) =>
if not node?
assert(prev?)
@kharandziuk
kharandziuk / playbook.yml
Created February 21, 2016 08:45
Install node and npm with ansible on ubuntu box
# now you don't need to use curl
tasks:
- apt_key:
url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
# change trusty for your distributive name
- apt_repository: repo="deb https://deb.nodesource.com/node_5.x trusty main" state=present
@kharandziuk
kharandziuk / playbook.yml
Created January 20, 2017 15:43
ansible playbook for postgis
# -*- mode: yaml-*-
# vi: set ft=yaml sw=2 ts=2 :
- name: Configure scala study machine
hosts: all
sudo: True
vars:
pg_version: 9.4
pg_conf: "/etc/postgresql/{{ pg_version }}/main/postgresql.conf"
pg_hba: "/etc/postgresql/{{ pg_version }}/main/pg_hba.conf"
@kharandziuk
kharandziuk / flatmap.js
Created January 24, 2017 16:03
strange flatmap behaviour
const request = require('superagent');
const _ = require('lodash');
const H = require('highland');
const Promise = require('bluebird');
function getLocations() {
const call = request
.get('http://viatorapi.viator.com/service/taxonomy/locations')
.query({apiKey: API_KEY})
return Promise.resolve(call)
.then((res) => res.body.data)