Skip to content

Instantly share code, notes, and snippets.

View mlesikov's full-sized avatar
😀

Mihail Lesikov mlesikov

😀
View GitHub Profile
import com.google.appengine.api.taskqueue.Queue;
import com.google.appengine.api.taskqueue.QueueFactory;
import com.google.appengine.api.taskqueue.TaskQueuePb;
import com.google.appengine.api.taskqueue.dev.LocalTaskQueueCallback;
import com.google.appengine.api.urlfetch.URLFetchServicePb;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.google.appengine.tools.development.testing.LocalTaskQueueTestConfig;
import com.google.apphosting.api.ApiProxy;
import org.junit.After;
/**
* @author Adelin Ghanayem [email protected]
*/
public class SitebricksReplyAssertion {
public static <T> void assertIsRepliedWith(Reply<T> reply, T expected) {
assertFieldValue("entity", reply, expected);
}
public static <T> void assertThatReplyStatusIs(Reply<T> reply, int expected) {
public class PageRoutingServlet extends HttpServlet {
private Map<String, PageController> pages = Maps.newHashMap();
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
pages.put("/page1", new PageController() {
@Override
@mlesikov
mlesikov / angularjs_directive_attribute_explanation.md
Created June 14, 2016 15:00 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@mlesikov
mlesikov / completion-for-gradle.md
Created July 22, 2016 06:56 — forked from nolanlawson/completion-for-gradle.md
Gradle tab completion for Bash. Works on both Mac and Linux.

Gradle tab completion script for Bash

A tab completion script that works for Bash. Relies on the BSD md5 command on Mac and md5sum on Linux, so as long as you have one of those two commands, this should work.

Usage

$ gradle [TAB]
@mlesikov
mlesikov / contact-form-servlet
Created June 2, 2017 08:47 — forked from fizerkhan/contact-form-servlet
Google App Engine Servlet for Contact form
String name = req.getParameter("name");
String email = req.getParameter("email");
String message = req.getParameter("message");
// Create Mail message
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("[email protected]",
"Acme Support Team"));
@mlesikov
mlesikov / ShardedSequence.java
Created August 9, 2018 07:49 — forked from cilogi/ShardedSequence.java
A sharded sequence generator for App Engine. Useful for a short URL generator
import com.google.appengine.api.datastore.*;
import com.google.appengine.api.memcache.MemcacheService;
import com.google.appengine.api.memcache.MemcacheServiceFactory;
import com.google.common.collect.ImmutableMap;
import java.util.ConcurrentModificationException;
import java.util.Map;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
'use strict';
angular
.module('datetimepicker', [])
.provider('datetimepicker', function () {
var default_options = {};
this.setOptions = function (options) {
default_options = options;
fix for hotkeys not functional in non-latin keyboard layout in 13.10 / 14.04
tested on ubuntu 14.04, jvm7 and rubymine 6.3
sudo add-apt-repository ppa:attente/java-non-latin-shortcuts
sudo apt-get update
sudo apt-get dist-upgrade
restart unity-settings-daemon
now ctrl+c, ctrl-v etc should work in most java applications like IDEA, RubyMine IDE even on russian keyboard layout
@mlesikov
mlesikov / mysql-docker.sh
Created March 12, 2020 10:27 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE