Skip to content

Instantly share code, notes, and snippets.

View pellepim's full-sized avatar

Jon Nylander pellepim

View GitHub Profile
function aClosedClosure(name){
var lastName = 'Dahlstrom';
return function(firstNameLocal){
if(firstNameLocal)
{
return firstNameLocal +' '+ lastName;
}
else
{
return lastName;
POST /api/v1/document-container/27123/ HTTP/1.1
Host: service.projectplace.com
name=New.doc&content=CONTENT_OF_FILE
PUT /api/v1/document-container/2377321/New.doc HTTP/1.1
Host: service.projectplace.com
CONTENT_OF_FILE
if len(selected) == 1:
mem_string = 'no_of_member_added'
else:
mem_string = 'no_of_members_added'
@pellepim
pellepim / createActivityWithTitle.sql
Created June 28, 2011 10:29
Stored procedure for inserting a new activity
CREATE PROCEDURE [ppdbuser].[createActivityWithTitle] @project_id integer, @creator_id integer, @title varchar(255)
AS
INSERT INTO ppActivities (project_id, creator_id, title, local_id)
VALUES (@project_id, @creator_id, @title, (SELECT ISNULL(MAX(local_id)+1,1) FROM ppActivities WHERE project_id = @project_id))
SELECT * FROM ppActivities WHERE id = scope_identity()
@pellepim
pellepim / gist:1069562
Created July 7, 2011 13:54
Apache rewrite to get authorization header to environment var
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)$ [NC]
RewriteRule /.* - [E=HTTP_AUTHORIZATION:%1]
@pellepim
pellepim / jslint_erroneous_warning.js
Created December 2, 2011 08:52
jsLint erroneous warning
var PP = PP || {};
PP.singleton = (function () {
var foo = function () {
// jsLint will warn that "bar" is not defined. Which is true in essence, but not in reality
// since the bar function is defined before it will be possible to call foo, it is not really an issue.
bar();
},
bar = function () {
alert("OMG");
@pellepim
pellepim / trace
Created December 7, 2011 13:29
wikimedia bootstrapextension trace
1. I've put BootstrapExtension.php in my extensions folder
2. I've included it through LocalSettings.php
3. When I try to edit a page with the following
<row>
<span-one-third>
</span-one-third>
</row>
I get the below trace on wikimedia 1.16.1. Any ideas?
@pellepim
pellepim / gist:1798556
Created February 11, 2012 10:20
test_layout
class EnterpriseModule_tests(Enterprise_tests):
def setUp(self):
self.setUpEnterprise()
def test_ClassInModule(self):
""" Tests everything about the ClassInModule class """
def _test_function_1():
""" Tests the first function in the ClassInModule """
doSomething()
self.assertSomething()
@pellepim
pellepim / apiconnection.py
Last active June 17, 2017 16:45
Projectplace Python API connection wrapper
# -*- coding: utf-8 -*-
"""
Example Usage:
>>> from apiconnection import ApiConnection
>>> settings = {
... 'api_endpoint': 'https://api.projectplace.com',
... 'consumer_key': 'REDACTED',
... 'consumer_secret': 'REDACTED'}