My names Dwight

dwit.us

Ask

Archive

RSS

Theme
  1. http://emailitfor.us

    I’m putting together a simple and free web service for developers.

    It’s convenient for static site contact forms. Or serverless games and apps to provide feedback and much more.

    For those situations where you can’t setup, or don’t need a server, or when you’re unhosted.

    Such as if your personal site is hosted on github, amazon s3, or even here on tumblr.

    Or if you have a single page app with no server, you can drop in a form with an action pointing to my service and it’ll forward the message to your inbox.

    If you want more control a simple jsonp request can be used instead.

    You’ll be able to customize your forms or jsonp requests to have any field you want.

    Your users won’t have to leave your site or app to send you an email.

    No email clients necessary.

    <form action="//www.emailitfor.us/sendit" method="post">
        <textarea name="message"></textarea>
        <input type="email" name="from" required>
        <input type="hidden" name="token" value="token">
        <input type="submit" value="Send">
    </form>
        $.ajax({
            url: '//emailitfor.us/sendit',
            dataType: 'jsonp',
            data: {
              from: 'your@email.com',
              message: "value of text area"
              },
          })
          .done(function(data) {
            console.log('success', data);
          });


    You’ll be able to reply to the message as if they emailed you directly. More features to come, such as management, multiple recipients, templates to get you startedanalytics, whatever you want. I am open to feature requests at this time.

    You can subscribe to be notified when it’s ready

    For more information you can email me at dwightdoane@me.com

    I am actually using it myself for another personal project 0lli.com, as well as my personal website (hosted on github)

    $('body').on('submit', '#feedback', function(e) {
        e.preventDefault();
        var data = $(this).serialize();
               or
    var data = {
    message: 'hello there',
      from: 'their@email.com
    email: 'your@gmail.com',
    } $.ajax({ url: '//www.emailitfor.us/sendit', dataType: 'jsonp', data: data }) .done(function(data) { $('input').blur(); $('#feedback_text').val('Thank You!'); }); });

    I’m using Meteor.js and hosting it on OpenShift

  2. Relaunching my webapp soon

    I really like backbone.js
    I just finished rewriting the bulk of my little meteorjs app I call Olli
    It’s a simple list making app with an emphasis on mobile devices. Right now it’s mostly gestures. Tap. Double tap and swipe.
    Each list item can also contain it’s own list. And each item in those lists can have another list. Ad infinitum.

    I’m using a local storage wrapper for backbone.
    Now everything stays on the device. No worrying about logging in or account setup and syncing to a database or database management.
    Before it took up to 7 seconds to load only a few items on a 3G connection.
    Now it’s instantaneous even without internet. Since I’m using appcache.

    Meteor is great. But my app is too small scale and simple for it.
    Where as backbone is perfect.

    All that’s left is some final tweaking and testing. I’ll probably try to launch it this weekend.
    Most likely going to set it up on amazon s3 since it’s a static single page app. And I can get a year of hosting free. I already have a domain.
    I’m going to make a couple small videos of it in action first and post them here.

  3. Stumped

    dwightdoane:

    keturahwalters:

    I’ve still been practicing JavaScript and have come across a problem that has stumped me.  It is just to create a method that accepts an array of names, and returns an array of each name capitalized.  In Ruby this would be pretty simple, but JavaScript is a whole other animal.  I’m only able to return the first word capitalized.  I’m not able to return the other words. Pretty sure my for loop is written correctly.  Anyone have an idea leave a comment.

    This is my code:

    image

    Take the return out of the for loop. otherwise it ends the loop prematurely.

    for (var i = 0; i < names.length; i++ ) {

      result.push(names[i].charAt(0).toUpperCase() + names[i].substr(1));

    }

    return result;

    should work.

        function capMe(names) {
      var result = [];
    
      for(var i = 0; i < names.length; i++) {
        result.push(names[i].charAt(0).toUpperCase() + names[i].substr(1));
      }
      return result;
    }
    
  4. Stumped

    keturahwalters:

    I’ve still been practicing JavaScript and have come across a problem that has stumped me.  It is just to create a method that accepts an array of names, and returns an array of each name capitalized.  In Ruby this would be pretty simple, but JavaScript is a whole other animal.  I’m only able to return the first word capitalized.  I’m not able to return the other words. Pretty sure my for loop is written correctly.  Anyone have an idea leave a comment.

    This is my code:

    image

    Take the return out of the for loop. otherwise it ends the loop prematurely.

    for (var i = 0; i < names.length; i++ ) {

      result.push(names[i].charAt(0).toUpperCase() + names[i].substr(1));

    }

    return result;

    should work.

  5. I’m going to rewrite my meteor.js app in backbone, and start completely fresh.

    Nothing against meteor, its a great framework, but my app needs to be able to work completely offline. Its just not fast enough when it has to connect to a db

    Trying to use my app on the go, using sprint’s 3g network, makes it harder than it should be. It takes several seconds for my data to be available.

    So I’m going to rewrite it to be offline first, then maybe sync to a database later.

    I learned a lot about meteorjs, structuring and building an app and javascript in general, and am hoping i learn even more by rebuilding it in backbonejs.

  6. I really like codewars.com

    it really tests my javascript knowledge, and makes me solve problems i wouldn’t normally come across.

    Then after I solve it I get to see how others have solved it and I gain even more knowledge from seeing their solutions.

  7. Once again making meteor.js my bitch

    I guess 0.8.0 changed how they did their login flow with facebook

    I hacked together a different way to generate a profile and login with Facebook, since Meteor’s built in {{loginButtons}} do not work well when you are using the mobile web app capable meta tag, or ‘standalone’ mode on mobile

    You can read about it here

    All I had to do was add 

    var x = DDP._CurrentInvocation.get();
    var token = Accounts._generateStampedLoginToken();
    Accounts._insertLoginToken(userData.userId, token);
    Accounts._setLoginToken(userData.userId, x.connection, Accounts._hashLoginToken(token.token))x.setUserId(userData.userId)

    Dont ask me how I figured it out. I just looked at their accounts-base/accounts_server.js source code on github

    its 2am and my brain is fried.

  8. fuck it

    Im just gonna base64 encode my images and save them to my mongodb collection

    fuck turning them into a binary blob, and fuck uploading them to s3

    blobs have limited support, and uploading to s3 means having to download them every time the app loads

    running a few quick tests on my iPhone 4s iOS 7 loading 3 images from my localhost

    1: datauri base64 encoded loads the fastest

    2: binary blob

    3: s3 hosted image

    even on my macbook pro with 16gb ram, base64 wins out

    all of them have the same image loaded

    base64 encoded images have pretty broad support across browsers/devices

    so fuck it

    its quick and easy

  9. return List.find({$or : [{owner:userId}, {“admins.id” : {$in: [userId]}}]}, {sort: {‘index’: 1}})

    I fucking love Meteor.js

  10. So I spent my day figuring out how to save an image to amazon s3 using meteor.js

    Well, amazon’s nodejs aws-sdk

    but I fuckin did it.

    One step at a time.

        Meteor.methods({
      uploadImage: function(imgData, img_id) {
        var regex = /^data:.+\/(.+);base64,(.*)$/;
    
        var matches = imgData.match(regex);
        var data = matches[2];
        var buffer = new Buffer(data, 'base64');
    
    
        var uploadparams = {
              Key: img_id+'.jpg',
              ContentType: 'image/jpeg',
              Body: buffer,
              ACL: 'public-read'
            };
    
        s3.putObject(uploadparams, Meteor.bindEnvironment(function(error) {
          if(error) {
            console.log(error)
          }
          else {
            var url = 'https://s3-us-west-2.amazonaws.com/bucketname/'+img_id+'.jpg';
    
            Meteor.call('editImgSrc', img_id, url, function(error, data) {
              console.log(error, data);
            })
    
          }
        }))
      }
    });
    

    Where ‘img_id’ is the id of the ‘model’ or ‘data context’