Skip to content

Instantly share code, notes, and snippets.

Henning Glatter-Götz hglattergotz

Block or report user

Report or block hglattergotz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hglattergotz
hglattergotz / custom_naming.xml
Last active Apr 6, 2016
Example of how to customize the ShortVariable rule in PHP Mess Detector
View custom_naming.xml
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Custom Naming Rules"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Customizations for the naming rule sets. Do not include the naming ruleset in the options.
This customization pulls all naming rules in and overrides some properties.
</description>
View hypermedia.json
{
"_links": {
"self": {
"href": "https://api.foxycart.com/users/1",
"title": "This User"
},
"https://api.foxycart.com/rels/attributes": {
"href": "https://api.foxycart.com/users/1/attributes",
"title": "Attributes for This User"
},
View keybase.md

Keybase proof

I hereby claim:

  • I am hglattergotz on github.
  • I am hglattergotz (https://keybase.io/hglattergotz) on keybase.
  • I have a public key whose fingerprint is 920F 89A9 D47D F82A D46D 8C16 F640 DC21 0505 3AF4

To claim this, I am signing this object:

View gist:2645678
### GIT-PROMPT.SH CONFIG
###
### lines commented-out with single '#' are default values
### lines commented-out with double '##' are examples
###
### NOTE: this is bash syntax - no spaces around "="
###########################################################
# error_bell=off # sound terminal bell when command return code is not zero. (use setterm to set pitch and duration)
@hglattergotz
hglattergotz / exercise7p2.js
Created Nov 11, 2011
Homework Exercise 7 part 2
View exercise7p2.js
// Part 2.
// Use this new function to refactor the code example.
// Some good test numbers: 524287, 9369319, 2147483647 (all primes)
//
// In other words, if you have this code:
//
// Function.prototype.cached = function(){
// ? (what goes here?)
// }
//
@hglattergotz
hglattergotz / exercise7p1.js
Created Nov 11, 2011
Homework Exercise 7 part 1
View exercise7p1.js
// Part 1.
// Implement a function prototype extension that caches function results for
// the same input arguments of a function with one parameter.
//
// For example:
// Make sin(1) have the result of Math.sin(1), but use a cached value
// for future calls.
Function.prototype.cached = function() {
var cache = {}, extendedFunction = this;
View exercise1.2.js
function Car(make, color) {
return {
make: arguments[0],
color: arguments[1],
log : function() {
console.log("I'm a " + this.color + " " + this.make);
}
};
}
View exercise1.1.js
var car = {
make: 'Maserati',
color: 'silver'
}
function logCar() {
console.log("I'm a " + arguments[0].color + " " + arguments[0].make);
}
logCar(car);
View closure.js
var cdClosure = function() {
var index;
function log() {
console.log(index);
}
function iterate() {
log();
View cleanup.js
function isCreditCard( CC ) {
var sum, mul, l, digit, tproduct, i;
if (CC.length > 19)
return (false);
sum = 0; mul = 1; l = CC.length;
for (i = 0; i < l; i++) {
digit = CC.substring(l-i-1, l-i);
You can’t perform that action at this time.