Skip to content

Instantly share code, notes, and snippets.

View icio's full-sized avatar
💬
icio is typing...

Paul Scott icio

💬
icio is typing...
View GitHub Profile
!ENTRY org.eclipse.ui 4 4 2010-09-10 15:43:00.865
!MESSAGE Exception in org.eclipse.ui.internal.PageLayout.addView: org.eclipse.ui.PartInitException: Could not create view: net.refractions.udig.project.ui.layerManager
!STACK 1
org.eclipse.ui.PartInitException: Could not create view: net.refractions.udig.project.ui.layerManager
at org.eclipse.ui.internal.ViewFactory.createView(ViewFactory.java:158)
at org.eclipse.ui.internal.LayoutHelper.createView(LayoutHelper.java:162)
at org.eclipse.ui.internal.PageLayout.createView(PageLayout.java:543)
at org.eclipse.ui.internal.PageLayout.addView(PageLayout.java:416)
at org.eclipse.ui.internal.PageLayout.addView(PageLayout.java:390)
at uk.co.terinea.agrimark.Perspective.createInitialLayout(Perspective.java:14)
@icio
icio / gist:720026
Created November 29, 2010 14:42
spanChars
function spanChars(e)
{
if (!e) e = document.body;
// Replace the text node with a span for each letter it consists of
if (e.nodeType == document.TEXT_NODE)
{
var text = e.nodeValue;
for (var c = 0; c < text.length; c++)
@icio
icio / gist:729309
Created December 5, 2010 18:13
largest_prime_factor
<?php
test();
/**
* The largest prime factor
*
* The provided number is not considered a factor of itself.
*
* @param int $n The number we wish to find a factor of
@icio
icio / gist:766327
Created January 5, 2011 13:48
include_subdirectories_in_path
<?php
/**
* Add each directory within ./application to the include path so that each file
* is easily accessible.
*/
function include_subdirectories_in_path()
{
global $paths;
$paths = array('application');
function bad (foo) {
if ( ! (foo instanceof Bar) ) {
throw new TypeError("This is an annoying restriction!");
}
return foo.baz(foo.quux(10));
}
function good (foo) {
if ( !foo.baz || !foo.quux ) {
throw new TypeError("We need foo to have baz and quux methods.");
@icio
icio / gist:826934
Created February 15, 2011 01:30
Raphael.el.wave
/*
- Example usage of Raphael.el.wave
- Produces: http://i.imgur.com/qAcDJ.png
*/
var paper;
/**
* ENTRY POINT.
*/
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class Main extends Sprite
@icio
icio / gist:848120
Created February 28, 2011 21:54
Newton-Raphson in R
#| Using the Newton-Raphson Method, find the root of
#| the function f (with derivative fdx) near the
#| point x (with tolerance e [solution x has abs f(x) < e]
#| and within a limit of 1000 steps)
newtonRaphson <- function(x, f, fdx, e = 0.001, maxSteps = 1000)
{
step = 0;
while (abs(x) > e && step < maxSteps)
{
@icio
icio / manifest.json
Created March 17, 2011 17:44
Chrome extension to list all tab locations and copy them to the clipboard
{
"name": "Open URL Collector",
"version": "1.0",
"description": "Creates a list of the URLs of open tabs.",
"browser_action": {
"default_icon": "famfamfam_silk_cut_tab.png",
"popup": "popup.html"
},
"permissions": ["tabs"]
}
@icio
icio / get_prime.php
Created March 22, 2011 22:37
N-th Prime Numbers
<?php
/**
* A method for finding n-th prime numbers. Usage example follows at the end.
* @author Paul Scott <paul.scotto@gmail.com>
*/
/**
* Calculate the n-th prime number(s).
*