Skip to content

Instantly share code, notes, and snippets.

View edp1096's full-sized avatar

Robert Sung-wook Shin edp1096

View GitHub Profile
@Phrogz
Phrogz / SVG Path to Polygon.js
Created February 27, 2011 04:28
Convert a SVG path to a Polygon by sampling the path, but also including all control points in the result. See http://phrogz.net/SVG/convert_path_to_polygon.xhtml
// http://phrogz.net/SVG/convert_path_to_polygon.xhtml
function pathToPolygon(path,samples){
if (!samples) samples = 0;
var doc = path.ownerDocument;
var poly = doc.createElementNS('http://www.w3.org/2000/svg','polygon');
// Put all path segments in a queue
for (var segs=[],s=path.pathSegList,i=s.numberOfItems-1;i>=0;--i) segs[i] = s.getItem(i);
var segments = segs.concat();
@zeffii
zeffii / PostScriptParsing_004.py
Created November 21, 2011 16:52
PostScript to javascript/paperjs using Python
'''
20 Nov, Dealga McArdle. 2011
This script is released under the MIT license. With no warranty/support of any kind.
PostScript to javascript/paperjs converter written in Python. It should be
obvious to anyone with a brain that Adobe and PostScript are registered trademarks.
The Adobe PostScript References, PLRM.pdf, is available for free from their site.
Their TOC implies that it's OK to write programs that parse their .ps filetype. I plan
to support commands as i encounter them.
@bramp
bramp / clip.class.php
Created November 26, 2011 18:05
PHP Polygon Clipping using the Sutherland-Hodgman algorithm
<?php
/**
* Polygon Clipping
* @author Andrew Brampton me <at> bramp <dot> net
* @url http://bramp.net/blog/2011/11/php-polygon-clipper-using-the-sutherland-hodgman-algorithm/
*
* Based on the Sutherland-Hodgman algorithm (1974).
* http://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm
*
* This approache assumes four clip edges (the bounding box).
@zhouming
zhouming / MY_Session.php
Created September 8, 2012 05:51
Use redis in Codeigniter Session.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session extends CI_Session{
private $sess_use_redis = TRUE;
private $redis = '';
public function __construct($params = array()) {
//parent::__construct();
$this->CI =& get_instance();
@amoilanen
amoilanen / webcrawler.js
Last active March 24, 2022 03:14
Simple PhantomJS-based web crawler library
//PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov [email protected] 2012
//UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler"
//the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist
(function(host) {
function Crawler() {
this.visitedURLs = {};
};
@netpoetica
netpoetica / ImportSVGToSymbol.html
Created January 8, 2013 05:06
In Paper.js, use importSVG to import an svg node to a useable symbol and remove it from the DOM.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Paperjs - ImportSVG to Symbol</title>
<script type="text/javascript" src="js/lib/paper.js"></script>
<script type="text/paperscript" canvas="canvas">
function SVGSymbol(elem){
var a = new Symbol(paper.project.importSvg(elem));
elem.parentNode.removeChild(elem);
@capotej
capotej / testcache.go
Created July 28, 2013 00:53
Single node, nonnetwork example of groupcache
package main
import (
"fmt"
"github.com/golang/groupcache"
)
type SlowDB struct {
data map[string]string
}
@ismasan
ismasan / sse.go
Last active August 23, 2024 08:47
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
@jpoehls
jpoehls / Caddyfile
Created May 7, 2015 23:29
Caddyfile PHP on Windows
# http://caddyserver.com/download
http://localhost:8080 {
startup php.cmd &
fastcgi / 127.0.0.1:9123 php
}