Skip to content

Instantly share code, notes, and snippets.

View miry's full-sized avatar

Michael Nikitochkin miry

View GitHub Profile
@miry
miry / server.go
Created November 3, 2014 14:55
My first web server
package main
import (
"fmt"
"net/http"
)
type String string
type Struct struct {
@miry
miry / circle.yml
Created October 13, 2014 18:47
Circle CI to run multiple Ruby versions and Platforms
machine:
ruby:
version: jruby-1.7.16
java:
version: openjdk7
environment:
RAILS_ENV: test
JRUBY_OPTS: -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -X-C -Xcompile.invokedynamic=false --1.9 -J-Xmx2g
dependencies:
#!/usr/bin/perl
# Original code: https://code.google.com/p/gource/wiki/GravatarExample
#fetch Gravatars
use strict;
use warnings;
use LWP::Simple;
use Digest::MD5 qw(md5_hex);

OAth + Rails 4 Tutorial

Step 1: Rails

$ gem install rails
$ rails new oath_provider_sample
$ cd oath_provider_sample
$ git init .
$ git add .
@miry
miry / say.js
Last active August 29, 2015 14:06
var say = function(string1) {
var result = function(string2) {
return say(string1 + " " + string2);
}
result.prototype = new String();
result.toString = function() {
return string1;
@miry
miry / priceFormatter.js.coffee
Last active August 29, 2015 14:04
Example how to use jQuery FormatCurrency plugin Accounting
# Usage:
# - Download the jquery plugin from https://github.com/openexchangerates/accounting.js
# - Save the min file in the `vendor/assets/javascripts/ folder
# - Add this file to `app/assets/priceFormatter.js.coffee`
# - Add to `app/assets/application.js.coffee`:
# `#= require accounting.js`
# `#= require priceFormatter.js`
class PriceFormatter
constructor: ($scope) ->
{
"name": "application",
"description": "Sets up rails project",
"default_attributes": {
"rails-stack": {
"deployer": "deployer",
"authorized_keys": [
"PUBLIC_KEY_FOR_APP_DEPLOYER_USER1",
"PUBLIC_KEY_FOR_APP_DEPLOYER_USER2"
@miry
miry / remote_rails_console.sh
Created January 23, 2014 12:20
Run remote Rails console
ssh example.com "cd /data/apps/example/current && ( RAILS_ENV=production RBENV_ROOT=/data/rbenv RBENV_VERSION=2.0.0-p247 /data/rbenv/bin/rbenv exec bundle exec rails console)"
# Codingame: http://www.codingame.com/ide/?target=clogin&s=1&id=227787048586488d4709f87be22b41eab2321d#!test:247723:true:%2523!list
n = STDIN.gets.to_i
if n == 0
puts 0
exit
end
values = STDIN.gets.split(' ').map(&:to_i)
/ip dns static add address=127.0.0.1 ttl=600w name=".*\\.vk\\.com"
/ip dns static add address=127.0.0.1 ttl=600w name="rs.mailer.ru"
/ip dns static add address=127.0.0.1 ttl=600w name="googleads.g.doubleclick.net"
/ip dns static add address=127.0.0.1 ttl=600w name="pagead2.googlesyndication.com"
/ip dns static add address=127.0.0.1 ttl=600w name="www.googletagservices.com"
/ip dns static add address=127.0.0.1 ttl=600w name="a.pr.dotua.org"
/ip dns static add address=127.0.0.1 ttl=600w name="google-analytics.com"
/ip dns static add address=127.0.0.1 ttl=600w name=".*\\.google-analytics\\.com"
/ip dns static add address=127.0.0.1 ttl=600w name="mc.yandex.ru"
/ip dns static add address=127.0.0.1 ttl=600w name="share.yandex.ru"