Skip to content

Instantly share code, notes, and snippets.

@gferreira
gferreira / upload-file-to-server.py
Created July 12, 2011 00:05
upload file to server via ftp
import os
from ftplib import FTP
def connectToServer(url, login, password, folder, verbose=False):
# create FTP connection
ftp = FTP(url, login, password)
if verbose == True:
print "%s" % ftp.getwelcome()
# move to folder
@gferreira
gferreira / elementar.jquery.js
Created September 9, 2011 16:24
Elementar jQuery plugin [DRAFT]
/* Elementar jQuery plugin [DRAFT] */
// use Elementar fonts via Typotheque's web font system
// args: family name, style name, webfont key
$('.myClass').eFont('Sans A', '13 21 2', 'WF-XXXXXX-XXXXX')
// use self-hosted fonts
// args: family name, style name, path to fonts folder
$('.myClass').eFont('Sans A', '13 21 2', '../fonts/')
@gferreira
gferreira / symphony-stylebot.txt
Created October 29, 2011 20:07
CSS-tweaks for the SymphonyCMS website (Stylebot)
{"symphony-cms.com":{"_enabled":true,"_rules":{"div.code-block pre":{"line-height":"1.7em"},"div.comment-body ol li":{"line-height":"1.7em"},"div.comment-body ol":{"margin-bottom":"1em"},"div.subsection.compound h2":{"font-family":"Lucida Grande","font-size":"1.8em","line-height":"1.4em"},"div.subsection.compound p":{"line-height":"1.4em"},"div.comment-body p em":{"font-family":"Georgia","font-size":"1.1em"},"body":{"font-family":"Lucida Grande"},"a.current":{"border-radius":"0"},"#streams":{"background":"none"},"#submit":{},"ul.pagination":{"border-radius":"0"},"div.section.base-4":{"background":"none"},"div.comment-body blockquote p":{"margin":"0"},"li.gravatar a img":{"border-radius":"0"},"div.comment-body p":{"line-height":"1.7em","margin-bottom":"1em"},"div.comment-body h4":{"padding":"0 0 1em 0"},"div.subsection.simple h3":{"font-family":"Lucida Grande"},"ul li a":{"corner-radius":"0"},"div.panel":{"corner-radius":"0"},"#subnav":{"border-radius":"0"},"a.vcard":{"border-radius":"0px"},"a.vcard img":{"bor
@gferreira
gferreira / robofont-custom-dialogs.txt
Created November 8, 2011 17:28
Custom dialogs for RoboFont [DRAFT]
+----------------------------------+
| transform selected glyphs |
+----------------------------------+
| |
| ( ) round |
| ( ) decompose |
| ( ) auto contour order |
| ( ) auto contour direction |
| (×) remove overlaps |
| (×) mark { color } |
@gferreira
gferreira / interpolated-nudge-dialog.py
Created January 4, 2012 06:44
interpolated nudge dialog
# [h] interpolated nudge dialog
'''a simple RoboFont dialog for the famous "interpolated nudge" script'''
# Interpolated Nudge for RoboFont -- Travis Kochel
# http://tktype.tumblr.com/post/15254264845/interpolated-nudge-for-robofont
# Interpolated Nudge -- Christian Robertson
# http://betatype.com/node/18
@gferreira
gferreira / import-ufo-into-layer.py
Created March 28, 2012 08:09
import ufo into layer
# [h] import ufo into layer
import os
f = CurrentFont()
ufo_path = '/fonts/_Publica/_ufos/Publica_95.ufo' # path to your ufo
ufo = RFont(ufo_path, showUI=False)
layer_name = os.path.split(ufo_path)[1]
@gferreira
gferreira / create-anchors.txt
Created November 30, 2012 13:16
options for a `create anchors` dialog
# options for a `create anchors` dialog for hTools2
1. Simple dialog, allowing the creation of `top` and `bottom` anchors with
positions relative to the font’s x-height (top) and baseline (bottom).
|---------------------|
| # create achors |
|---------------------|
| |
| [ ] top |
@gferreira
gferreira / simple-accent-builder.py
Created June 12, 2013 11:47
simple accent builder
# [h] simple accent builder
# functions
def build_glyph(font, glyph_name, accents_dict, verbose=True):
if accents_dict.has_key(glyph_name):
if verbose:
print 'building %s...' % glyph_name
base_glyph, accents = accents_dict[glyph_name]
font.removeGlyph(glyph_name)
@gferreira
gferreira / quick-transfer.py
Created September 5, 2013 09:15
quickly transfer all glyphs from the current font to another open font
# [h] quick transfer glyphs
src = CurrentFont()
dst = AllFonts().getFontsByStyleName('95')[0]
for g in src:
dst.insertGlyph(g)
dst.update()
@gferreira
gferreira / find-bezier-point.py
Last active April 18, 2019 21:34
find a point in a Bezier segment
'''find a point in a Bezier segment'''
# formulas converted from:
# http://13thparallel.com/archive/bezier-curves/
# run this script in DrawBot: http://drawbot.com/
def B1(t): return t*t*t
def B2(t): return 3*t*t*(1-t)
def B3(t): return 3*t*(1-t)*(1-t)