Skip to content

Instantly share code, notes, and snippets.

View AshokEmrys's full-sized avatar

Ashok Emrys AshokEmrys

View GitHub Profile
-(void)setContentOffset:(CGPoint)contentOffset
{
const CGSize contentSize = self.contentSize;
const CGSize scrollViewSize = self.bounds.size;
//automatically center scrollview content when the scroll size is within bounds
if (contentSize.width + self.contentInset.left + self.contentInset.right < scrollViewSize.width) {
contentOffset.x = - (scrollViewSize.width - contentSize.width) / 2.0;
}
if (contentSize.height + self.contentInset.top + self.contentInset.bottom < scrollViewSize.height) {
contentOffset.y = - (scrollViewSize.height - contentSize.height) / 2.0;
@AshokEmrys
AshokEmrys / hci.rb
Created August 11, 2014 10:35 — forked from callumj/hci.rb
require 'uri'
require 'net/http'
require 'fileutils'
BASE = "http://openclassroom.stanford.edu/MainFolder/courses/HCI/videos/"
for l in 1..42 do
for p in 1..20 do
uri = "CS147L" + l.to_s + "P" + p.to_s + ".flv"
from kivy.uix.label import Label as K_Label
from kivy.properties import OptionProperty
from kivy.lang import Builder
from kivy.graphics import Rectangle, Color
class CLabel(K_Label):
orientation = OptionProperty('horizontal', options=(
'horizontal', 'vertical'))
def __init__(self, *args, **kwargs):
super(CLabel, self).__init__(*args, **kwargs)
@AshokEmrys
AshokEmrys / python_resources.md
Created July 23, 2014 16:26 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

!-------------------------------------------------------------------------------
! Xft settings
!-------------------------------------------------------------------------------
Xft.dpi: 96
Xft.antialias: false
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight