var welcome_user = new Template('#{welcome} #{name}!!');
welcome_user.parse({ welcome: "Hello", name: "John" });
//returns "Hello John!!"
welcome_user.parse({ welcome: "Hola", name: "Peter" });| # Customize BASH PS1 prompt to show current GIT repository and branch. | |
| # by Mike Stewart - http://MediaDoneRight.com | |
| # SETUP CONSTANTS | |
| # Bunch-o-predefined colors. Makes reading code easier than escape sequences. | |
| # I don't remember where I found this. o_O | |
| # Reset | |
| Color_Off="\[\033[0m\]" # Text Reset |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
| using System.Collections.Generic; | |
| using System.Linq; | |
| using UnityEngine; | |
| /// <summary> | |
| /// Parallax scrolling script that should be assigned to a layer | |
| /// | |
| /// This is related to the tutorial http://pixelnest.io/tutorials/2d-game-unity/parallax-scrolling/ | |
| /// |
| // http://stackoverflow.com/questions/15829172/stop-chrome-back-forward-two-finger-swipe | |
| $(document).on('mousewheel', function(e) { | |
| var $target = $(e.target).closest('.scrollable-h'); | |
| if ($target.scrollLeft () <= 4) { | |
| $target.scrollLeft(5); | |
| return false; | |
| } | |
| }); | |
| jQuery.fn.brightness = function() { | |
| var bg_color, rgba, y; | |
| bg_color = this.css('background-color'); | |
| if ((bg_color != null) && bg_color.length) { | |
| rgba = bg_color.match(/^rgb(?:a)?\(([0-9]{1,3}),\s([0-9]{1,3}),\s([0-9]{1,3})(?:,\s)?([0-9]{1,3})?\)$/); | |
| if (rgba != null) { | |
| if (rgba[4] === '0') { | |
| if (this.parent().length) return this.parent().brightness(); | |
| } else { | |
| y = 2.99 * rgba[1] + 5.87 * rgba[2] + 1.14 * rgba[3]; |
| // Just before switching jobs: | |
| // Add one of these. | |
| // Preferably into the same commit where you do a large merge. | |
| // | |
| // This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
| // and then it quickly escalated into more and more evil suggestions. | |
| // I've tried to capture interesting suggestions here. | |
| // | |
| // Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
| // @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
| // Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload | |
| var fs = require('fs'); | |
| var AWS = require('aws-sdk'); | |
| AWS.config.loadFromPath('./aws-config.json'); | |
| var s3 = new AWS.S3(); | |
| // File | |
| var fileName = '5.pdf'; | |
| var filePath = './' + fileName; | |
| var fileKey = fileName; |
In case you don't know me already, I'm Jarrod Nettles, a Senior Developer at Apple Inc. I also go by the Twitter handle @hayvok, and blackshawk on Github (don't ask me why they're different). I have no real, formal blog since, well, I work at Apple. I'm posting this because I confused a good many people and I feel honor-bound to explain.
On April 1st Hacker News had their "Who's Hiring" thread. Since I'm currently looking for a developer, I decided to go ahead and post. Here's the content of that post, along with a link to the original.
https://news.ycombinator.com/item?id=5475813 - Original HN Post
Apple Inc: Cupertino, CA - Web Developer (PHP, Node.js, Ember.js) - Sorry, no remote!! Relocation offered. (I know, I know...) We're rebuilding an internal app from scratch and it needs to be blazing fast and real-time.
Here's our tech stack (right now).
##The Singleton Pattern
class SantaClaus {
private static uniqueInstance : SantaClaus;