Skip to content

Instantly share code, notes, and snippets.

@rudyryk
rudyryk / TextMeter.cs
Last active August 8, 2021 10:53
C# — Measure string size in Xamarin.Forms for iOS and Android platforms
//
// TextMeter.cs
// Created by Alexey Kinev on 11 Feb 2015.
//
// Licensed under The MIT License (MIT)
// http://opensource.org/licenses/MIT
//
// Copyright (c) 2015 Alexey Kinev <[email protected]>
//
// Usage example:
@rudyryk
rudyryk / Avatar.cs
Last active August 22, 2018 13:51
C# — Simple rounded avatar class example for Xamarin.Forms
//
// Avatar.cs
// Created by Alexey Kinev on 26 Feb 2015.
//
// Licensed under The MIT License (MIT)
// http://opensource.org/licenses/MIT
//
// Simple rounded avatar class example for Xamarin.Forms.
//
using System;
@rudyryk
rudyryk / ImageMeter.cs
Last active October 6, 2023 11:32
C# — Get image size by name in Xamarin.Forms for iOS and Android platforms
//
// ImageMeter.cs
// Created by Alexey Kinev on 9 May 2015.
//
// No Rights Reserved
// http://creativecommons.org/publicdomain/zero/1.0/
//
// Get image size by name in Xamarin.Forms for iOS and Android platforms.
//
using System;
@rudyryk
rudyryk / AndroidManifest.android-xml
Created May 15, 2015 05:06
Silver - basic sample for WebView on Android
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellofire">
<!-- the android:debuggable="true" attribute is overwritten by the compiler when the debug info option is set -->
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="@string/app_name"
android:icon="@drawable/icon"
android:debuggable="true">
@rudyryk
rudyryk / CustomTableViewRenderer.cs
Created August 3, 2015 13:17
C# — Custom Xamarin.Forms renderer for TableView to hide empty cells at the bottom
// NoEmptyRowsTableViewRenderer.cs
//
// No Rights Reserved
// http://creativecommons.org/publicdomain/zero/1.0/
//
// Assume you have `MyProject.MyTableView` sublass of
// `Xamarin.Forms.TableView` and want to hide extra
// empty rows at the bottom. All you need on iOS is to set
// `TableFooterView` to empty `UIView` in custom renderer.
//
@rudyryk
rudyryk / jquery.classify.js
Created October 24, 2015 12:39
Draft for jQuery Classify plugin
/*!
Classify plugin for binding elements to objects or functions ('classes')
and events to 'methods'.
Example:
var Navbar = {
signIn: function(evt, target) { ... },
signUp: function(evt, target) { ... },
};
@rudyryk
rudyryk / jquery.put-upload.js
Created December 2, 2015 17:28
Draft jQuery plugin for drag'n'drop uploader with PUT octet-stream request
/*!
Stream signle file upload with PUT octet-stream request.
(c) 2015 Alexey Kinev <[email protected]>
The MIT License, https://opensource.org/licenses/MIT
*/
(function ( $ ) {
$.fn.putUpload = function( opts ) {
var el = $( this );
@rudyryk
rudyryk / jquery.smartlinks.js
Created January 19, 2016 18:15
jQuery plugin for "smart" links like back button etc.
@rudyryk
rudyryk / common_tags.py
Last active January 28, 2016 14:31
Django generic helpers template tags
# -*- coding: utf-8 -*-
#
# No Rights Reserved
# http://creativecommons.org/publicdomain/zero/1.0/
from __future__ import unicode_literals
from urllib.parse import urlencode, parse_qs, urlsplit, urlunsplit
from django.template import Library
from django.utils.safestring import mark_safe
@rudyryk
rudyryk / post-receive
Last active May 23, 2022 16:00
Git post-receive hook sample for basic Django project
#!/usr/bin/env python
#
# No Rights Reserved
# http://creativecommons.org/publicdomain/zero/1.0/
"""Git post-receive hook script
Suggested project structure::
/home/$_USER/
env/