Skip to content

Instantly share code, notes, and snippets.

@g4s8
g4s8 / logcat.tmLanguage
Created October 29, 2015 07:52
Android logcat messages highlighting in sublime text 2
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>uuid</key>
<string>36B0ED25-AAB7-42B2-BB65-4297F6D1D271</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
class ImmutableClass(type):
def __new__(mcs, class_name, bases, class_dict):
instance = type.__new__(mcs, class_name, bases, class_dict)
instance.__setattr__ = ImmutableClass._setattr_impl
instance.__delattr__ = ImmutableClass._delattr_impl
return instance
def __call__(cls, *args, **kwargs):
obj = type.__call__(cls, *args, **kwargs)
obj.__immutable__ = True
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication10 {
public static class CollectionsMerge {
private interface IMergeNode<T> {
class Program
{
static void Main(string[] args)
{
var x = new[] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
var target = "x";
typeof(string).GetField("m_stringLength", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(target, 16);
Console.WriteLine(target);
Console.Read();
}
@g4s8
g4s8 / permissions.xml
Created November 21, 2016 15:52
Full android permission list
<?xml version="1.0" ?>
<permissions>
<permission dangerous="true" group="android.permission-group.CALENDAR">
android.permission.READ_CALENDAR
</permission>
<permission dangerous="true" group="android.permission-group.CALENDAR">
android.permission.WRITE_CALENDAR
</permission>
<permission dangerous="true" group="android.permission-group.CAMERA">
android.permission.CAMERA
package test.com.equalsizelayout;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
public class RootLayout extends android.widget.FrameLayout {
@Nullable
private WindowInsetsCompat windowInsets;
public RootLayout(Context context) {
this(context, null);
}
public RootLayout(Context context, AttributeSet attrs) {
final class StyledContext extends ContextThemeWrapper {
@StyleRes
private static int themeRes(@NonNull final Resources.Theme theme, @AttrRes final int themeResId) {
final TypedValue outValue = new TypedValue();
theme.resolveAttribute(themeResId, outValue, true);
return outValue.resourceId;
}
public StyledContext(final Context ctx, final @AttrRes int themeResId) {
super(ctx, themeRes(ctx.getTheme(), themeResId));
public final class PrintedSpec {
private final int mode;
private final int size;
public PrintedSpec(int spec) {
this(MeasureSpec.getMode(spec), MeasureSpec.getSize(spec));
}
private PrintedSpec(final int mode, final int size) {
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0