Skip to content

Instantly share code, notes, and snippets.

@rudyryk
rudyryk / build-bootstrap.py
Last active June 4, 2016 11:56
Build Bootstrap from SCSS sources with Python
#!/usr/bin/env python
#
# No Rights Reserved
# http://creativecommons.org/publicdomain/zero/1.0/
"""Build Bootstrap from SCSS sources with Python
Install Bootstrap::
bower install bootstrap
@rudyryk
rudyryk / 01_init_server.sh
Last active April 27, 2016 17:35
Quick setup scripts for Ubuntu 16.04 LTS Server and Python web applications (Nginx + PostgreSQL)
#!/bin/bash
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES
# OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# Nginx initial proxy config for Pgweb
server {
listen 80;
client_max_body_size 8m;
server_name pgweb.domain.com;
keepalive_timeout 5;
root /var/www/pgweb;
@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/
@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 / jquery.smartlinks.js
Created January 19, 2016 18:15
jQuery plugin for "smart" links like back button etc.
@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 <rudy@05bit.com>
The MIT License, https://opensource.org/licenses/MIT
*/
(function ( $ ) {
$.fn.putUpload = function( opts ) {
var el = $( this );
@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 / 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 / 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">