Skip to content

Instantly share code, notes, and snippets.

View korniltsev's full-sized avatar
🏳️‍🌈
s/jz/jnz/

Tolya Korniltsev korniltsev

🏳️‍🌈
s/jz/jnz/
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/CigDividersWrapper">
<View
style="@style/CigWeightHelper"/>
<View
style="@style/CigWeightHelper"/>

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

  • virtualenv
  • Django
  • nginx
  • uwsgi
@korniltsev
korniltsev / strings.xml
Created March 29, 2013 12:54
zaharov localization
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="report_formatted">
<![CDATA[Give up smoking android application review\nName:%5$s\nsimple:%1$b\nclear:%2$b\naccessibly:%3$b\ncomfortable:%4$b\n]]></string>
<string name="report_email">quit.smoking@yandex.ru</string>
<string name="app_name">Stop smoking</string>
<!-- Tabs -->
<string name="my_course">MY COURSE</string>
<string name="about_method">METHOD</string>
<string name="technique">TECHNIQUE</string>
@korniltsev
korniltsev / gist:5335883
Created April 8, 2013 10:44
Emoji scary regexp
package ru.kurganec.vk.messenger.utils.emoji;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.text.Editable;
import android.text.Html;
import android.text.Spanned;
@korniltsev
korniltsev / gist:5698503
Created June 3, 2013 14:23
HOWTO Merge Folder Trees (...using the command line)
HOWTO Merge Folder Trees (...using the command line)
There comes a time when you need to do this sort of thing and the Finder’s default behavior (which is to completely replace folder contents, rather than merge them as in Windows) just gets in the way.
Regardless of the reasons for this behavior and its counter-intuitiveness for those not accustomed to the UNIX way, it’s sometimes necessary to merge two folder trees with the minimum of fuss, and there are three ways to do it:
# The standard UNIX way
cp -R -v source/. destination
# The geeky UNIX way (restartable)
rsync -vaEW source/ destination
# The OSX "easy" way
ditto -V source destination
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.drawable.Drawable;
import android.os.Build;
// Copyright 2012 Pierre-Yves Ricau
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
@korniltsev
korniltsev / gist:80a35f76a65c49c5a2df
Last active August 29, 2015 14:02
cool lexer definition
/*
* The scanner definition for COOL.
*/
import java_cup.runtime.Symbol;
%%
%{
@korniltsev
korniltsev / cool.cup
Last active August 29, 2015 14:02
cool.cup 70
/*
* cool.cup
* Parser definition for the COOL language.
*
*/
import java_cup.runtime.*;
/* Stuff enclosed in {: :} is copied verbatim to the class containing
all parser actions. All the extra variables/functions you want to use
def createSlackTasks() {
mAndroidAppExtension.applicationVariants.all{
if (!it.buildType.debuggable){
def task = mProject.tasks.create("slack${it.name.capitalize()}", UploadSlackTask)
task.variant = it
task.dependsOn it.assemble
}
}
}