Skip to content

Instantly share code, notes, and snippets.

View merqlove's full-sized avatar

Alexander Merkulov merqlove

View GitHub Profile
@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 / iconv_install_ubuntu14.sh
Last active August 25, 2021 10:28 — forked from paulczar/gist:5493708
Install libiconv on Ubuntu 14.04
--- srclib/stdio.in.h.orig 2011-08-07 16:42:06.000000000 +0300
+++ srclib/stdio.in.h 2013-01-10 15:53:03.000000000 +0200
@@ -695,7 +695,9 @@
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
@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 / osx_fix.sh
Created December 7, 2015 11:45
OSX Preferences
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat
defaults write NSGlobalDomain InitialKeyRepeat -int 12
# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
# Disable window animations ("new window" scale effect)
@merqlove
merqlove / dynamic.java
Created November 2, 2015 12:08
Dynamic methods in java
class Logger {
private BiConsumer<Object, Integer> logger = null;
// ...
private Logger(Object logger) {
this.akkaLogger = (LoggingAdapter) logger;
this.logger = (message, level) -> {
switch (level) {
case INFO: akkaInfo(message);
@merqlove
merqlove / swig.rb
Last active October 23, 2015 22:37
Swig
require 'formula'
class Swig < Formula
url 'http://downloads.sourceforge.net/project/swig/swig/swig-2.0.4/swig-2.0.4.tar.gz'
homepage 'http://www.swig.org/'
sha256 '763a117730d26f8e5ed67f5718c6c0761fbb8461680fc20269db8c0839e1ec8a'
depends_on 'pcre'
def install