{"action":"created","issue":{"url":"https://api.github.com/repos/idmontie/Discover-What-Rocks/issues/2","labels_url":"https://api.github.com/repos/idmontie/Discover-What-Rocks/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/idmontie/Discover-What-Rocks/issues/2/comments","events_url":"https://api.github.com/repos/idmontie/Discover-What-Rocks/issues/2/events","html_url":"https://github.com/idmontie/Discover-What-Rocks/issues/2","id":50926118,"number":2,"title":"Unique Slugs","user":{"login":"idmontie","id":412382,"avatar_url":"https://avatars.githubusercontent.com/u/412382?v=3","gravatar_id":"","url":"https://api.github.com/users/idmontie","html_url":"https://github.com/idmontie","followers_url":"https://api.github.com/users/idmontie/followers","following_url":"https://api.github.com/users/idmontie/following{/other_user}","gists_url":"https://api.github.com/users/idmontie/gists{/gist_id}","starred_url":"https://api.github.com/users/idmontie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idmontie/subscriptions","organizations_url":"https://api.github.com/users/idmontie/orgs","repos_url":"https://api.github.com/users/idmontie/repos","events_url":"https://api.github.com/users/idmontie/events{/privacy}","received_events_url":"https://api.github.com/users/idmontie/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/idmontie/Discover-What-Rocks/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-12-04T04:01:25Z","updated_at":"2015-01-18T03:40:50Z","closed_at":"2015-01-18T03:40:50Z","body":"Make sure to add \"reserved\" keywords:\r\n\r\n* delete\r\n* reserve\r\n* add\r\n* edit\r\n* update\r\n\r\n```\r\nthis.slug = function ( str ) {\r\n    var original = str;\r\n\r\n    str = str.replace(/^\\s+|\\s+$/g, ''); // trim\r\n    str = str.toLowerCase();\r\n\r\n    // remove accents, swap ñ for n, etc\r\n    var from = 'ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;';\r\n    var to   = 'aaaaaeeeeeiiiiooooouuuunc------';\r\n    for (var i = 0, l = from.length ; i < l ; i++) {\r\n      str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));\r\n    }\r\n\r\n    str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars\r\n      .replace(/\\s+/g, '-') // collapse whitespace and replace by -\r\n      .replace(/-+/g, '-'); // collapse dashes\r\n\r\n\r\n    //  make sure slugs are globally unique\r\n\r\n    var notUnique = _$.Slugs.findOne( {\r\n      slug : str\r\n    } )\r\n\r\n    if ( notUnique !== undefined &&\r\n         notUnique !== null ) {\r\n      // Not unique, better retry with a random phrase attached!\r\n      var phrase = Random.choice( _$.Util.slug.phrases )\r\n      return _$.Util.slug ( original + ' ' + phrase )\r\n    }\r\n\r\n    // Right before we finish up, save the slug\r\n    // to a special slug table\r\n    _$.Slugs.insert( new _$.Slug( {\r\n      slug : str\r\n    } ) )\r\n\r\n    return str;\r\n  };\r\n```"},"comment":{"url":"https://api.github.com/repos/idmontie/Discover-What-Rocks/issues/comments/70395311","html_url":"https://github.com/idmontie/Discover-What-Rocks/issues/2#issuecomment-70395311","issue_url":"https://api.github.com/repos/idmontie/Discover-What-Rocks/issues/2","id":70395311,"user":{"login":"idmontie","id":412382,"avatar_url":"https://avatars.githubusercontent.com/u/412382?v=3","gravatar_id":"","url":"https://api.github.com/users/idmontie","html_url":"https://github.com/idmontie","followers_url":"https://api.github.com/users/idmontie/followers","following_url":"https://api.github.com/users/idmontie/following{/other_user}","gists_url":"https://api.github.com/users/idmontie/gists{/gist_id}","starred_url":"https://api.github.com/users/idmontie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idmontie/subscriptions","organizations_url":"https://api.github.com/users/idmontie/orgs","repos_url":"https://api.github.com/users/idmontie/repos","events_url":"https://api.github.com/users/idmontie/events{/privacy}","received_events_url":"https://api.github.com/users/idmontie/received_events","type":"User","site_admin":false},"created_at":"2015-01-18T03:40:50Z","updated_at":"2015-01-18T03:40:50Z","body":"Still not unique, but the slugs are a little more readible.  Closing for now."}}