Skip to content

Instantly share code, notes, and snippets.

@mjvesa
mjvesa / vaadin_with_python.md
Created September 25, 2019 19:26
Article about writing Vaadin apps in Python

Python and Vaadin 14

In this article we will see how Vaadin UIs can be written using Python. We'll use Jython which implies Python 2.7. GraalVM will be considered in a later article.

Wiggling Python into Vaadin

First download a server side starter from vaadin.com or any other place. We won't be using client side templates, but build UIs purely using code. Next

@DingWeizhe
DingWeizhe / 寶寶.js
Last active March 8, 2017 14:05
新增line的功能
var fs = require('fs'),
http = require('http'),
https = require('https'),
express = require('express'),
bodyParser = require('body-parser'),
request = require('request'),
crypto = require('crypto'),
FBToken = '',
port = 443,
options = {
@1wheel
1wheel / geometry.js
Last active November 8, 2022 13:46
line-intersection
//creates new point
function P(x, y, color){
var rv
if (x.map){
rv = {x: x[0], y: x[1], color: 'black'}
} else{
rv = {x: x, y: y, color: color || 'black'}
}
rv.toString = function(){ return rv.x + ',' + rv.y }
rv.type = 'point'
@evgeny-goldin
evgeny-goldin / gist:636b408832524542c789
Last active October 13, 2022 15:12
Downgrade Boot2Docker and Docker from 1.3.0 to 1.2.0 on OS X
Based on http://stackoverflow.com/a/4158763/472153:
* brew tap homebrew/boneyard
* cd $( brew --prefix )
* brew versions docker
* git checkout 9ccfc7e Library/Formula/docker.rb
* brew unlink docker
* brew install docker
* brew switch docker 1.2.0
@bestlong
bestlong / jquery-validator-twid.js
Last active August 29, 2015 14:04
jquery.validator for Taiwan ID
//增加固定長度的 validation rule
$.validator.addMethod("exactlength", function(value, element, param) {
return this.optional(element) || value.length == param;
}, $.validator.format("輸入長度必須為 {0} 個字元."));
$.validator.addMethod("checkTWPID", function(value, element, param) {
var letters = new Array('A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M',
'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
'X', 'Y', 'W', 'Z', 'I', 'O');
@mdunisch
mdunisch / How you get Sail.js running on Openshift.md
Last active July 13, 2023 14:51
Get Sails.js running on Openshift

#How you get Sail.js running on Openshift#

This instruction is tested with:

  • Sails.js v0.9.16
  • Node.js 0.10 on Openshift ( 05 May 2014)

###1) package.json

If you use the package.json build by sails new Projectname than you have to add a few fields for openshift – so the server can start you app automatically. Sails uses Grunt to build minify css/js and so on. Openshift dont have grunt installed so you have to add this also.

"""
Helper module for displaying ROOT canvases in ipython notebooks
Usage example:
# Save this file as rootnotes.py to your working directory.
import rootnotes
c1 = rootnotes.default_canvas()
fun1 = TF1( 'fun1', 'abs(sin(x)/x)', 0, 10)
c1.SetGridx()
@1stvamp
1stvamp / mac-curl-ca-bundle.sh
Created March 22, 2012 12:50
Script to install cURL CA certificates on OS X without macports
#!/bin/bash
mkdir /tmp/curl-ca-bundle
cd /tmp/curl-ca-bundle
wget http://curl.haxx.se/download/curl-7.22.0.tar.bz2
tar xzf curl-7.22.0.tar.bz2
cd curl-7.22.0/lib/
./mk-ca-bundle.pl
if [ ! -d /usr/share/curl/ ]; then
sudo mkdir -p /usr/share/curl/
else
@xdite
xdite / gist:758319
Created December 29, 2010 07:56
Ruby / Rails Convention of Techbang

Rails 開發注意要點

About Ruby Syntax

  • 編輯器設定 soft tab (space=2),以 2 格空白符號做為程式內縮距離(不分語言)。
  • 函式如果只有一個參數,就不強制打()
  • 函式如果有二個以上的參數,通通都要有 ()
    • (避免發生奇怪的paser bug跟保持專案一致性)
  • 字串限定用雙引號包覆
  • 善用 "#{str1} #{str3} " 等字串改寫技巧取代不需要的字串加法。
@mislav
mislav / pagination.md
Created October 12, 2010 17:20
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o