Skip to content

Instantly share code, notes, and snippets.

View miry's full-sized avatar

Michael Nikitochkin miry

View GitHub Profile
{
"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 / 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) ->
@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;

OAth + Rails 4 Tutorial

Step 1: Rails

$ gem install rails
$ rails new oath_provider_sample
$ cd oath_provider_sample
$ git init .
$ git add .
#!/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);
@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 / main.go
Last active August 29, 2015 14:10
package main
import (
"fmt"
"net/http"
"github.com/HitFox/ad_server/app"
"github.com/HitFox/ad_server/handler/bulk"
"github.com/HitFox/ad_server/mid"
"runtime"
// RUN: go test -run=XXX -bench=. string_con_test.go
// OUTOUT:
/*
PASS
BenchmarkNaiveConact 2000000000 0.64 ns/op
BenchmarkJoinsConact 3000000 432 ns/op
BenchmarkBuffer 3000000 541 ns/op
ok command-line-arguments 5.262s
*/
package main
# encoding: utf-8
require 'nokogiri'
require 'csv'
def parse_row(row)
result = {}
row.children.each do |el|
next if el.name == 'text'
result[el.name] = el.text.strip
@miry
miry / 100-honeybadger-deploy.config
Created March 4, 2015 09:39
ElasticBeanstalk Honeybadger deploy notification script: .ebextensions/100-honeybadger-deploy.config
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/01_notify.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
EB_CONFIG_SOURCE_BUNDLE=$(/opt/elasticbeanstalk/bin/get-config container -k source_bundle)
EB_SUPPORT_FILES=$(/opt/elasticbeanstalk/bin/get-config container -k support_files_dir)