Skip to content

Instantly share code, notes, and snippets.

View merqlove's full-sized avatar

Alexander Merkulov merqlove

View GitHub Profile
@merqlove
merqlove / puma.service
Last active February 2, 2017 15:30
SystemD Puma example
[Unit]
Description=MRCR Sites Puma Server
Requires=redis@6379.service mongod.service
Wants=redis@6379.service mongod.service
After=redis@6379.service mongod.service
[Service]
Type=simple
User=merkulov
PIDFile=/srv/apps/sites_mrcr_ru/shared/tmp/pids/puma.pid
@merqlove
merqlove / demo.liquid
Last active January 29, 2017 12:09
Liquid example
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ site.name }}</title>
<meta charset="utf-8">
<meta name="format-detection" content="telephone=no" />
<link rel="icon" href="{{ 'favicon.ico' | theme_image_url }}">
<link rel="shortcut icon" href="{{ 'favicon.ico' | theme_image_url }}">
{{ 'style.css' | stylesheet_tag }}
{{ 'jquery.js' | javascript_tag }}
@merqlove
merqlove / app.html
Last active January 9, 2017 15:42
Autocomplete Address with Semantic UI
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Autocomplete address With Semantic UI</title>
<link rel="stylesheet" href="semantic/dist/semantic.css">
</head>
<body>
Concurrent
.future(thread_pool) do
update_spin(spin, title: "Resizing image #{image.id}")
service.run(image)
end
.then do |r|
update_spin(spin, title: "Resized image #{r.id}")
r
end
.rescue { |_| nil }
@merqlove
merqlove / best_some_a.ex
Last active August 13, 2016 15:53
IntelliJ Elixir debug aliasing with base features.
module Best.SomeA do
def some_func, do: IO.puts("Hello World!"
end
@merqlove
merqlove / config.ex
Last active July 30, 2016 17:20 — forked from bitwalker/config.ex
Useful config wrapper for Elixir
defmodule Config do
@moduledoc """
This module handles fetching values from the config with some additional niceties
"""
@default_app_name :some_app
@default_endpoint SomeApp.Endpoint
@doc """
Fetches key from the default endpoint config, and prepare it with _get/3.
@merqlove
merqlove / categories.sql
Last active June 8, 2016 16:24
Joomla K2 2.x migrate to Native Joomla 2.5
INSERT INTO lgcp8_categories (id, title, alias, parent_id, published, access, description, language, created_user_id, modified_user_id, metadesc, metakey, metadata, params, extension) SELECT id+1000, name, alias, CASE WHEN parent = 0 THEN 1 ELSE parent+1000 END, published, access, description, language, 996, 0, name, name, "{}", "{\"category_layout\":\"\",\"image\":\"\"}", "com_content" FROM lgcp8_k2_categories
#!/usr/bin/env elixir
defmodule Committer do
defstruct [:name, :email]
def list(repo) do
repo
|> from_repo
|> Stream.unfold(fn str ->
case String.split(str, "\n", parts: 2, trim: true) do
@merqlove
merqlove / app.rb
Created January 28, 2014 01:22 — forked from hendrikswan/app.rb
require 'sinatra'
require 'mongoid'
require 'json'
require "sinatra/reloader" if development?
Mongoid.load!("mongoid.yml")
class Price
include Mongoid::Document
#!/usr/bin/env bash
set -o errtrace
set -o errexit
facter_version=$1
puppet_version=$2
target_volume=$3