Skip to content

Instantly share code, notes, and snippets.

View Cheesebaron's full-sized avatar
🧀
Send cheese please

Tomasz Cielecki Cheesebaron

🧀
Send cheese please
View GitHub Profile
@Cheesebaron
Cheesebaron / DummyFragment.cs
Created September 6, 2014 15:43
Removing Fragments from ViewPager
public class DummyFragment : Fragment
{
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var view = inflater.Inflate(Resource.Layout.dummy_frag, container, false);
var tv = view.FindViewById<TextView>(Resource.Id.textView1);
tv.Text = "" + Arguments.GetInt("number", -1);
return view;
}
}
@Cheesebaron
Cheesebaron / MockLocationSource.cs
Created September 25, 2014 15:36
Random MockLocationSource
using System;
using System.Threading;
using System.Threading.Tasks;
using Android.Gms.Maps;
using Android.Gms.Maps.Model;
using Android.Locations;
using Android.OS;
namespace RunForYourLife
{
public static void TryRequestWhenInUseAuthorization(this CLLocationManager locationManager)
{
if (locationManager.RespondsToSelector(new Selector("requestWhenInUseAuthorization")))
locationManager.RequestWhenInUseAuthorization();
}
public static void TryRequestAlwaysAuthorization(this CLLocationManager locationManager)
{
if (locationManager.RespondsToSelector(new Selector("requestAlwaysAuthorization")))
locationManager.RequestAlwaysAuthorization();
@Cheesebaron
Cheesebaron / Activity.cs
Last active August 29, 2015 14:08
MapFragment inside a ScrollView
public class MyActivity : Activity
{
private GoogleMap _map;
private HorizontalScrollView _hsv;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.rtc);
@Cheesebaron
Cheesebaron / blocklist.txt
Last active March 12, 2018 05:25
Blocklist for: https://chrome.google.com/webstore/detail/personal-blocklist-by-goo/nolijncfnkgaikbjbdaogikpmpbdcdef I hate stupid aggregators, which uses Stackoverflow QA etc. DIE DIE DIE!
28im.com
4byte.cn
acnenomor.com
adtandroid.blogspot.com
androidstackoverflow.blogspot.com
askmequest.gq
besttopics.net
bloglovin.com
c9q.net
codebaum.wordpress.com
@Cheesebaron
Cheesebaron / AwesomeView.cs
Last active June 6, 2020 10:51
Bindable SwipeRefreshLayout
[Activity(Label = "Awesome!")]
public class ValidationView
: MvxActivity<AwesomeViewModel>
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
RequestWindowFeature(WindowFeatures.ActionBar);
SetContentView(Resource.Layout.awesome_layout);
@Cheesebaron
Cheesebaron / CallActivity.cs
Last active September 23, 2015 11:36
Handle call and dial intents
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.OS;
using Android.Widget;
namespace Your.Namespace
{
[Activity(Label = "Call", LaunchMode = LaunchMode.SingleTop)]
[IntentFilter(new[] { Intent.ActionCall, Intent.ActionView },
@Cheesebaron
Cheesebaron / solaziredcsharp.sty
Created December 8, 2014 01:12
A solarized light theme for LaTeX C# code listings
\usepackage{listings}
\usepackage{etoolbox}
\usepackage{color}
\definecolor{base0}{RGB}{131,148,150}
\definecolor{base01}{RGB}{88,110,117}
\definecolor{base2}{RGB}{238,232,213}
\definecolor{sgreen}{RGB}{133,153,0}
\definecolor{sblue}{RGB}{38,138,210}
\definecolor{scyan}{RGB}{42,161,151}
@Cheesebaron
Cheesebaron / HangMan.java
Last active August 29, 2015 14:10
Shitty hangman
import java.util.*;
public class HangMan {
private static String[] words = {
"motherboard", "case", "powersupply", "harddrive", "mouse", "keyboard", "peripheral",
"graphicscard", "processor", "latency", "ping", "gaming", "resolution", "watercooling",
"cache", "memory", "chipset", "intel", "notebook", "desktop", "aliasing" };
public static void main(String[] args) {
Random rand = new Random();
@Cheesebaron
Cheesebaron / CodeShareReport.linq
Last active August 29, 2015 14:11 — forked from praeclarum/CodeShareReport.cs
LinqPad script counting lines. Yay \o/
// based on https://gist.github.com/praeclarum/1608597
void Main()
{
var projects = new List<Solution> {
new Solution {
Name = "Windows 8",
ProjectFiles = new List<string> {
"C:\\vcs\\git\\MastersThesis\\NoiseSentinelApp\\NoiseSentinelApp.Store\\NoiseSentinelApp.Store.Windows\\NoiseSentinelApp.Store.Windows.csproj",
"C:\\vcs\\git\\MastersThesis\\NoiseSentinelApp\\NoiseSentinelApp.Store\\NoiseSentinelApp.Store.Shared\\NoiseSentinelApp.Store.Shared.projitems",