Skip to content

Instantly share code, notes, and snippets.

@m039
m039 / shadow.xml
Created May 13, 2013 22:31
It is very strange feeling to write xml files for android like this in emacs.
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
(truncate (* 255 0.2))51 (#o63, #x33, ?3)
<gradient
android:startColor="#4C000000"
@m039
m039 / MemoryAccountContentProvider.java
Created September 13, 2013 12:39
Custom ContentProvider example, based on memory array (android)
/** WTFContentProvider.java ---
*
* Copyright (C) 2013 Mozgin Dmitry
*
* Author: Mozgin Dmitry <flam44@gmail.com>
*
*
*/
package com.m039.example.provider;
;; Playing with racket
(require net/url)
(require json)
(require rnrs/io/ports-6)
(define link "http://graph.facebook.com/")
(define (get-username id)
(let ((ht (call-with-port (get-pure-port (string->url (string-append link id)))
(lambda (p)
@m039
m039 / gist:8384823
Created January 12, 2014 13:55
android stuff
# clean application data
adb shell pm clear com.android.browser
@m039
m039 / TouchController.cs
Last active January 25, 2017 20:11
Very easy implementation to handle basic horizontal and vertical swipes for Unity on mobile devices
/// <summary>
/// TouchController allows you to handle basic swipes (left, right, top, bottom) on mobile device.
///
/// Usage: extend this class and don't forget to call Update in MonoBehaviour.Update
/// <summary>
public abstract class TouchController {
private readonly float _swipeThreshold;
private Vector2 _firstPosition;
@m039
m039 / 37.1.rkt
Last active January 28, 2017 12:43
Exercise 37.1 form the HtDPv1 book. A little bit overdone though.
#lang racket/gui
;;; Exercise 37.1 from the HtDP book. A little bit overdone.
;;;
;;; GUI related functions
;;;
(define (create-frame title size draw-callback on-event-handler)
(define custom-canvas%
@m039
m039 / Bar.hpp
Last active February 14, 2017 09:13
Issue when using empty namespace in CppSharp
#pragma once
#include "IBar.hpp"
// Bar hosts IBar
class Bar {
public:
IBar *impl;
@m039
m039 / spacemacs-gyp-layer.el
Created February 14, 2017 15:22
Spacemacs gyp layer
;;; packages.el --- gyp layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Dmitry Mozgin <m039@Dmitrys-MBP>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
@m039
m039 / Final.cs
Last active March 2, 2017 22:30
C# structs and classes as wrappers, performance benchmark
using System;
using System.Diagnostics;
namespace VoidSharedProject
{
// Results:
// 1: 00:00:47.3721840
// 2: 00:01:14.6771620
@m039
m039 / BT.cs
Created August 11, 2019 16:46
The Behavior Tree source code file from Unity's 2D Game Kit project.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BTAI
{
public enum BTState
{
Failure,
Success,