21 ms·
Left-pad as a service
- yvoschaap2 11y agoWhile very useful SaaS, I always use the tweet package manager from http://require-from-twitter.github.io/ http://require-from-twitter.github.io/
- supjeff 11y agoI went ahead and made an SDK https://www.npmjs.com/package/left-pad-io-js-sdk https://www.npmjs.com/package/left-pad-io-js-sdk
- noiv 11y agoThe try in browser fails with an unexpected token syntax error. Do you accept PRs?
- Hortinstein 11y agoI submitted a pull req to fix them...and added some tests. Sarcastic programming is fun!
- Hortinstein 11y agoyeah, I added some tests...did you mean to return strings? Also fixed some syntax errors
- mirekrusin 11y agoI think you should think ahead and change it to "any-pad" or something similar and offer adapters/plugins. What are users of your library do when some industry-disrupting startup comes in offering left- and mid- pads? Changing your npm shouldn't be a problem, just unpublish it and create new one. Also don't forget to check trademark list before creating npm because "they will come knocking on your doors closing all your accounts".
- venomsnake 11y agoI don't think this is enterprise ready. And I am not sure that they are able to scale their service. Left padding is serious business.
- danexxtone 11y agoWhere do I sign up for alpha- or beta-testing for right-pad.io?
- maremmano 11y agoWhat about splitting left and pad in two microservices?
- TickleSteve 11y ago3 maybe.... iteration-as-a-service also??
- tromp 11y ago2 micro-services should suffice for all computation: $ curl 'https://api.S.io/?x=x&y=y&z=z' {"S":"x z (y z)"} $ curl 'https://api.K.io/?x=x&y=y' {"K":"x"}
- krallja 11y agoThis is actually how AWS Lambda works under the covers.
- TickleSteve 11y ago...now theres an idea for a new language.... slightly verbose tho....
- GregBuchholz 11y agohttp://www.madore.org/~david/programs/unlambda/ http://www.madore.org/~david/programs/unlambda/
- jdeisenberg 11y agoHave we, or have we not, officially entered the silly season?
- andy_ppp 11y agoHahaha - isn't it hysterical how everyone using npm for small reusable code pieces! Aren't they morons! How stupid of people to trust their package manager to be consistent and correct and return packages they were expecting. How stupid of people to reuse small often used functions that only do one thing well. How does everyone taking the piss intend to protect themselves from this in their OS package manager, or PPM or composer or pip? It's not javascript devs fault that the standard library is so piss poor you need these short code snippets and I've definitely included small 5-10 line packages via npm or other package managers rather than roll my own because it's likely they have bug fixes I haven't considered. I can also use npm to share these snippets between the many projects I'm building. * No I wasn't affected by this because I review the packages that I want to include, however the level of smugness here is absolutely ridiculous.
- eknkc 11y agoI use a lot of micro modules. And I think micro modules are a good idea. But this whole thing is freaking funny. You gotta acknowledge that.
- andy_ppp 11y agoI dunno; I think it's a balancing act between dependencies and code reuse. I think npm needs to not let people unpublish stuff without thought - that is where the problem is and I'm sure they are thinking about a solution to this. I think a lot of this is implying "don't use micro packages on your package manager, copy and paste code in helpers.js FTW". I've seen people advocating this as if it's a better solution than have npm remain consistent even after people unpublish packages.
- eknkc 11y agoWell, I don't think we can trust NPM on being consistent. They gave away this guy's package to a corp, despite his protest just because they felt like it. I'm not arguing if it was the correct decision or not, it's just an arbitrary decision based on isaac's mood that day. It's best to treat NPM as mutable and don't depend on it. For example, I check in node_modules to git, even though everyone says no, use shrinkwrap! Yeah, that would definately help here. NPM is to blame here and people are right to make fun of the entire ecosystem around it. Also, It's just easy and funny. Noone will start copying stuff around just because of this I believe. The micromodule ecosystem emerged because it works for people apparently. Devs will find ways to make it work better.
- TickleSteve 11y agoPresumably this is using a docker instance on AWS or the like? </sarcasm> BTW: Well done... nothing like rubbing it in. :o)
- athrun 11y agoI suspect API Gateway + Lambda.
- c4n4rd 11y agoThis is really exciting!!! I was a bit disappointed that the right-pad will be out only in 2017. I am looking forward to that release because there is a high demand for it now. What kind of load balancing is being used on the back-end? I called leftpad(str, ch, len) with the length I needed and noticed that is not very scalable because it is blocking. A better approach I would recommend to those using it is to call the API in a for loop. In my tests, it had performance very close to those I see in C or assembly. I was a bit turned off that the free version can only handle strings up to 1024 in length. I know you need to make some money, but it is big turn off for a lot of my projects. Edit: I finally signed up for it but still noticed that I am only allowed to use 1024. I called your customer support line and they said I was calling the API from multiple IP addresses and for that I need an enterprise license. Please help me with this issue, it is very crucial at this point as my project is in a complete stop because of this.
- jameshart 11y agoBest practice for performance for large left-pad jobs is to call the service recursively using mapreduce. Remember that left-pad(str,pad,n) is equal to left-pad(left-pad(str,pad,n/2),left-pad("",pad,n/2),n). This should run in logarithmic time and is highly parallelizable. If you don't like the "" magic string in there you could replace it with a call to left-pad(null, null,0).
- capitalsigma 11y agooh god it's too real
- lucastx 11y agoPoe's law for programming culture extremists
- pajop 11y agoif you put https://api.left-pad.io/?len=1017 https://api.left-pad.io/?len=1017 or anything higher than 1016 it says: {"errorMessage":"len exceeds 1007 characters. Contact a left-pad.io sales engineer for an enterprise license","errorType":"Error","stackTrace":["exports.handler (/var/task/index.js:33:22)"]} wow. they even have an enterprise sales engineer! :)
- jeffreylo 11y agoDoesn't work with unicode characters: # ~ [8:47:18] $ curl 'https://api.left-pad.io/?str=點看&len=5&ch=0' https://api.left-pad.io/?str=點看&len=5&ch=0' {"str":"←ᄏ゙ワヒ"}%
- chiph 11y agoNeeds more Enterprise. Where are the factory factory builders?
- mhd 11y agoIf it doesn't have a CORBA and EJB interface, it's not enterprise.
- jaxondu 11y agoIt's 2016! Left-padding without any deep learning algorithm is so lame.
- faizshah 11y agoI don't understand why this community has to have a weekly cycle of bashing different programming communities. Every week there's a new drama thread bashing Java devs, Go devs, Javascript devs etc. The thing that I come to this community for every week is to read about new developments in our industry, if you don't come here for that then what are you coming here for? And wasn't it just a few months ago people were praising the innovation of Urbit for having a 'global functional namespace'? But because it's popular to hate on javascript devs for applying -- sorry, I forgot this was javascript bashing week -- for reinventing concepts from other areas in computer science and software engineering the HN community has to start hating on another programming community's work. That said this is a pretty funny satirical page, apologies to the author for venting at the HN community.
- reustle 11y agoIt's sad, really. I've been coding for roughly 11 years, since I was 14 or so, and have always noticed the constant pissing matches between programmer groups. It's easy to fall into them, because when you do something a certain way for so long, another way looks so foreign and terrible. I tried to make an effort to always stay out of those arguments, but absolutely fell in here and there. Lately I've stopped coding for work and moved into a PM++ position as I build up a small agency on my own, and it has been refreshing. I build little meteor apps for fun in my free time (omg meter doesn't scale noob lol) and can keep my blinders on to what the outside world thinks, and my devs can continue to do what they are comfortable with.
- TickleSteve 11y agoits called self-regulation. Each community has its own quirks and extremes as seen by everyone else. Without the bashing, they would become even more extreme. At least after this a lot of devs will think twice about making "micro-modules".
- faizshah 11y agoIf that were true java would have started dying a few years ago, javascript frameworks wouldn't pop up every week, and most people would use shell scripts instead of build tools. This is exactly the kind of flame war stuff the guidelines seem to have tried to stop.
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]
- pilif 11y agoAs a very sarcastic person, I highly approve of this. This absolutely reflects my opinion of all this mess. Thank you for making this site so that I don't have to write an opinion piece like everybody else seems to have to. Instead, if asked about the issue, I can just point them at this site. Yes. This isn't constructive, but this mess had so many layers that I really can't point to a single thing and offer a simple fix as a solution. As such I'm totally up for just having a laugh, especially when it really isn't being nasty against specific people but just laughing about the whole situation. Thank you to whoever made this
- ukyrgf 11y agoI don't expect to come across irreverent comedy on Hacker News, so I think the site is great! Creator: https://twitter.com/gabrielgironda https://twitter.com/gabrielgironda
- deleted 11y ago[deleted]
- creshal 11y agoI need a SOAP binding for this, because reasons.
- dozzie 11y agoFunny way to spell CORBA.
- icefox 11y agoNice, it is even bug compatible http://api.left-pad.io/?str=foo&len=7&ch=12 http://api.left-pad.io/?str=foo&len=7&ch=12 return {"str":"12121212foo"} and not {"str":"1212foo"}
- frandroid 11y agoProbably because they use the package itself?
- MoD411 11y agoBoy, that escalated quickly.
- p4bl0 11y agoAs a friend said on IRC, it's kind of sad that the website is not made with bootstrap.
- yyhhsj0521 11y agoI wonder whether the author uses leftpad on this site
- ritonlajoie 11y agoI'm looking for a Left-pad specialized linux distro. Anyone ?
- cmancini 11y agoThis is great, but I'll need an API wrapper package.
- bjackman 11y agohttps://www.npmjs.com/package/left-pad-service-api https://www.npmjs.com/package/left-pad-service-api
- beeboop 11y agoTomorrow: left-pad.io announces $120 million investment at $1.2 billion valuation Month from now: left-pad announces purchase of $170 million office building in SV to house their 1200 employees
- hguant 11y agoRelevant smbc http://www.smbc-comics.com/index.php?db=comics&id=2698 http://www.smbc-comics.com/index.php?db=comics&id=2698
- swasheck 11y agoEighteen months from now: left-pad announces massive reduction in workforce. 1150 laid off.
- griff122 11y agoTwo years from now, left-pad.io declares bankruptcy and shut down service. Lather, rinse, repeat.
- jschuur 11y agoIs it rate limited?
- tromp 11y agoMaybe each request should be accompanied by a proof-of-work, proving that the requester invested at least 10s of computation...
- facepalm 11y agoCool, but it would be more useful if they had a npm module for accessing the service.
- eric001 11y agohttps://www.npmjs.com/package/left-pad-io https://www.npmjs.com/package/left-pad-io
- ChemicalWarfare 11y agoBUG! (I think) using '#' as a 'ch' value pads the string with spaces: $ curl 'https://api.left-pad.io/?str=wat&len=10&ch=#' https://api.left-pad.io/?str=wat&len=10&ch=#' {"str":" wat"} Please provide github link to fork/submit pr :)
- pfooti 11y agoPretty sure you have to urlencode hashes, don't you? What happens if you do ch=%23?
- ChemicalWarfare 11y agogood point :) API needs to add a POST support with explicit description of rationale being the need to url encode characters when using a GET. Also needs HATEOAS.
- idiocratic 11y agoAre you hiring?
- deleted 11y ago[deleted]
- talideon 11y agoBut the question is, is it enterprise-ready? :-)
- markbnj 11y agoThis is awesome. Props to you all.
- huskyr 11y agoReminds me of Fizzbuzz enterprise edition: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...
- esailija 11y agofizzbuzz npm edition: var zero = require("number-zero"); var hundred = require("number-one-hundred"); var isDivisibleBy5 = require("is-divisible-by-5"); var isDivisibleBy3 = require("is-divisible-by-3"); var isDivisibleBy5and3 = require("is-divisible-by-5-and-3"); var numberToString = require("number-that-is-between-one-and-hundred-to-string"); var fizzbuzz = require("string-fizz-buzz"); var fizz = require("string-fizz"); var buzz = require("string-buzz"); var incrementByOne = require("increment-by-one"); var forLoop = require("for-loop"); var ifCondition = require("if-condition"); var elseIfCondition = require("else-if-condition"); var elseCondition = require("else-condition"); var lessThan = require("less-than"); var print = require("print-string"); forLoop(zero, lessThan(hundred), incrementByOne, function(i) { condition(isDivisibleBy5and3, print(fizzbuzz), elseIfCondition(isDivisibleBy3, print(fizz), elseIfCondition(isDivisibleBy5, print(buzz), elseCondition(print(numberToString(i)))))); });
- sidthekid 11y agoThis must be what heaven feels like!
- deleted 11y ago[deleted]
- andrepd 11y ago>`left-pad.io` is 100% REST-compliant as defined by some guy on Hacker News with maximal opinions and minimal evidence. Wonderful
- deleted 11y ago[deleted]
- a_imho 11y agoMy gut feeling tells me serious software engineers who look down on javascript programmers are feeling justified now. Brogrammers are exposed, hence the lot of knee jerk. Indeed, it is pretty funny, but dependency management still remains a hard problem.
- nogridbag 11y agoI'm late to the left-pad discussion. I thought it was considered a bad practice to depend on an external repo as part of your build process. At my company we use Artefactory to host our maven libs. Even if one were removed maven central our builds would continue to work fine (in theory).
- gefh 11y agoTerrible, terrible practice. But I think a lot of people got caught out as left pad was usually an indirect dependency, and using npmjs in your build is the quickest way to satisfy your dependency graph.
- mikeash 11y agoI'm always surprised at how common this is. You check out some repository, and it ends up having to fetch more stuff from all over creation. Whether it's just git submodules or some more sophisticated dependency manager, it seems like an obviously bad idea. It's OK if they're pulling from other repositories you own, but requiring external repositories as part of the checkout process seems like an obvious point of failure. There's all sorts of possibilities for malicious activities, and just plain downtime will affect you too. Storage is cheap, so it seems like there ought to be no reason not to pull in external dependencies and save them locally. Dependency managers should support and encourage this rather than defaulting to just referencing some random stuff off in space.
- toyg 11y agoThe reason is maintenance. Once you set up yet-another-repo-mirror (after your apt, rpm, nuget, pypi etc mirrors), someone needs to keep it up, back it up, secure it, refresh the packages, etc etc. It's "cloud culture": rely on some else's maintenance effort and just work on your own problems. Like all things, it has drawbacks.
- mikeash 11y agoI don't buy it. You need a place to keep your own repository, and once you have that, keeping copies of other repositories is pretty much free. Keeping up, backing up, and securing N repositories is no more work than doing that for one repository. You can still outsource this, even. There's nothing wrong with using GitHub or Bitbucket or whatever for your repositories, just make sure that you're using your repositories, not relying on other people's. The only thing that potentially gets harder is refreshing the packages, and I'd argue that's actually a good thing because that's really just saying that packages don't randomly change out from under you. In any case, your package manager should make it easy to refresh them when you want to, just say "go update that dependency to the latest available from the official source" and let it do its thing. If package managers don't offer this, they need to start.
- mschulze 11y agoAs a Java developer, I am a bit jealous. When people joke about us we usually only get a link to the Spring documentation of AbstractSingletonProxyFactoryBean (or maybe the enterprise hello world), but no one ever wrote that as a service. Maybe someone can do that? https://abstractsingletonproxyfactorybean.io https://abstractsingletonproxyfactorybean.io seems to be available!
- omnidan 11y agoThere kinda is! Have you heard of "Enterprisify"? It generates Java names like that: http://projects.haykranen.nl/java/ http://projects.haykranen.nl/java/
- talles 11y agoJesus Christ, is that a real thing!? http://docs.spring.io/autorepo/docs/spring/2.5.x/api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html http://docs.spring.io/autorepo/docs/spring/2.5.x/api/org/spr...
- nicholasjarnold 11y agoYes, the astronauts have been there. Edit: clarify astronauts http://www.joelonsoftware.com/articles/fog0000000018.html http://www.joelonsoftware.com/articles/fog0000000018.html
- 8note 11y ago> Convenient proxy factory bean superclass for proxy factory beans that create only singletons. that actually makes sense to somebody?
- uremog 11y agoAt least it's convenient...
- usrusr 11y agoBut it's kind of disturbing that the class name is hiding that convenience from us. How are we supposed to know that it is not an inconvenient...? It all starts getting really weird with Spring Data interfaces: a whole DSL written in camelcased method names, as if Spring deliberately turned a joke into a feature.
- nyfresh 11y ago100 times on the board http://bit.ly/1RzOIK2 http://bit.ly/1RzOIK2
- Jordrok 11y agoVery nice! Any plans for integration with http://shoutcloud.io/ http://shoutcloud.io/ ? I would love to have my strings both left padded AND capitalized, but the APIs are incompatible. :(
- Mopolo 11y agoThat would be fun if a company named Left Pad asked to get this domain like Kik did at the beginning of all this.
- stared 11y agoI am waiting for "integer addition as a service" (vide http://jacek.migdal.pl/2015/10/25/integer-addition.html http://jacek.migdal.pl/2015/10/25/integer-addition.html).
- deadcast 11y agoI'm working on it now. All plans will be free except if you want to use negative numbers. AWS will charge me more for 1 + (-1) as opposed to a 1 + 1 operation.
- rfrey 11y agoI'm very disappointed in the creators' choice of font for their landing page. Practically unreadable, my eyes burned.
- shitgoose 11y agothis is fantastic! What is your stack? Are you NoSQL or relational? Redis? What is your test coverage? I am sure you hiring only trendy developers. I see huge potential in your service, do you accept private investments? I would like to get in now, before Google or YC snatches you! again, keep up good work and - can't wait for right-pad next year!
- d0m 11y agoI'm ready to get downvoted to hell with this comment but here we go..: I feel like only non-javascript devs are bashing against small modules and NPM. All great javascript devs I know LOVE that mentality. Let me offer some reasons why I (as a current Javascript dev having professionally coded in C/C++/Java/Python/PHP/Scheme) think this is great: - Unlike most other languages, javascript doesn't come with a battery standard library. So you're often left on your own to reinvent the wheel. I mean, common, in Python you do "'hello'.ljust(10)" but AFAIK there isn't such thing in javascript. Javascript is more like the wild west where you need to reinvent everything. So having well tested libraries that does one thing extremely well is really beneficial. - Javascript, unlike most other languages, has some pretty insane gotchas. I.e. "'0' == 0" is true in javascript. Most devs have been burned so bad in so many ways in Javascript that it's comforting to use a battle-tested library, even for a small feature, rather than reinventing it. - And anyway, where should we put that function? Most big projects I've worked on have some kind of "helper file" that has 1500 lines, and then at some point different projects start depending on it so noone likes to touch it, etc. So, yeah, creating a new module takes a bit more time, but remember that it's not about the writing time but more about the maintenance time. I'd much rather have lots of small modules with clear dependencies than a big "let's put everything in there" file. - I feel arguing about whether something should be in a separate module is similar to arguing without something should be in a separate function. For me, it's like hearing "Hey, learn how to code, you don't need function, just write it when you need it." And hey, I've worked in projects professionally where they had no function and it was TERRIBLE. I was trying to refactor some code while adding function, and people would copy my function inside their 1500 lines file. Let me tell you I left that company really fast. - It's fair to say that UNIX passed the test of time and that the idea of having lots of small programs is extremely beneficial. It forces common interface and great documentation. Similar to how writing test force you to create better design, modularizing your code forces you to think about the bigger picture. - As far as I'm concerned, I really don't care whether a module is very small or very big, as long as what it does is well defined and tested. For instance, how would you test if a variable is a function? I don't know about you but my first thought wasn't: function isFunction(functionToCheck) { var getType = {}; return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; } Who cares if it's a 4 lines module. I don't want to deal with that javascript bullshit. Yes, I could copy past that in my big helper file, but I'd much rather used one that the javascript community use and test. - Finally, it seems like Node/javascript hasn't started that way. Not so far ago with had Yahoo monolithic javascript libraries and jquery. Even the first versions of most popular node library (such as express) were first written as a monolithic framework. But it's been refactored into dozen of small modules with clear functions. And now, other libraries can just import what they need rather than the whole project. OK, so I told you about the good thing. What about the bad thing? - Adding dependencies to a project is REALLY HARD TO MAINTAIN. I've had so many bad experience using node because of that. I.e. I work on a project, it's tested and work fine. 2 months later I clone and start the project and everything breaks. Oh, X and Y libraries decided to fuck everything, that other library now depend on a new version of Node, but I can't upgrade node because that other library depend on a previous version of Node. It's complex. I won't go on in explaining my solution to this problem, but enough to say that it's a problem and installing random amateur libraries in a professional project can lead to disaster. - It takes longer to code. I've touched that earlier. It's a tradeoff about write now vs maintain later. Take a look at segmentio github repo: https://github.com/segmentio https://github.com/segmentio. I'd personally love to have that as onboarding experience rather than some massive project with everything copy/pasted a few time. But yes, it took them more time to create those separate modules.
- bflesch 11y agoI get an error {"message": "Could not parse request body into json: Unexpected character (\'o\' (code 111)): was expecting comma to separate OBJECT entries\n at [Source: [B@6859f1ef; line: 2, column: 22]"} when using double quotes. It seems some JSON parsing fails. Not sure if this can be exploited, so I wanted to let you know. Demo link: https://api.left-pad.io/?str=%22; https://api.left-pad.io/?str=%22;
- adam-ff 11y agoI get an error changing the example request from 68 to 67 characters: https://api.left-pad.io/?str=paddin%27%20oswalt&len=67&ch=@ https://api.left-pad.io/?str=paddin%27%20oswalt&len=67&ch=@ {"message": "Could not parse request body into json: Unrecognized character escape \'\'\' (code 39)\n at [Source: [B@38ac0021; line: 2, column: 21]"}
- justaaron 11y agothis is hilarious and timely
- Flott 11y agoI'm desperately looking for some feedback from big users. - Does it scale well? - Is it pragmatic for long term use scenario? - Is it Thread safe? - Does it learn from previous call made to the API? - Does it have a modern access layer? - Does it enforce 2nd factor authentication? - Is it compatible with Docker containers? - What about multi-region scenarios? - Any benchmark available showing usage with AWS + cloudflare + Docker + a raspberry pi as LDAP server?
- mirekrusin 11y agoThere are rumors twitter is talking to those guys about 140 len version, they are likely to be acquired. We need to wait to see. Tomorrow we should know.
- mrcwinn 11y agoThey didn't even think to version their API. This is total crap.
- gumby 11y agoHELP!! The CEO heard about this new service and now my manager told me we need to upgrade all our packages to this new service ASAP! But there's nothing on stack overflow I can use to change our system! I need to get this pilot done STAT so we can plan the migration and send it out for bid! HELP!!
- sansjoe 11y agoA programmer is someone who writes code, not someone who installs packages. Do you really need someone else to pad strings for you? Come on.
- dkackman1 11y agoSECURITY NIGHTMARE!!!!!!!!! Without any sort of nonce, this service is trivially susceptible to a replay attack
- jug 11y agoIf left-pad.io goes down, will it take the rest of the WWW infrastructure with it? I'm missing a Q&A for important and apparently relevant questions like these.
- pka 11y agoThe real discussion is not about package managers, micromodules, or whatever. It's about "real programmers can write left_pad by themselves" and everybody else just sucks. True scotsmen etc. Now I don't know why asm people arent feeling threatened and aren't attacking the C left_pad gurus yet...
- sentilesdal 11y agofor the graphic designers out there who need left-pad, blue-steel-pad is now available.
- sentilesdal 11y agofor the graphic designers out there who need left-pad, blue-steel-pad is now available.
- gexla 11y agoCan someone explain to me why I might need this? I checked the site and the documentation is horrible. The site isn't professionally done and there are no videos. Can I rely on this service going to be around in 5 years? It just seems like this company might be, you know, a feature rather than a company.
- Blackthorn 11y agoWow, so funny. DAE lol javascript? Ugh, how does this garbage even get upvoted so highly.
- rahimnathwani 11y agoDo you have any client libraries available for different languages? I don't want to create a direct dependency between my code and your API. I'd rather create a dependency between my code and your client library's code, as I'm sure you will always keep that up to date with any API changes.
- deleted 11y ago[deleted]
- fallenshell 11y agoWill there be a premium plan?
- Schwolop 11y agoThis ain't got nothing on Fuck Off as a Service: https://www.foaas.com/ https://www.foaas.com/