This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Remember Last Edited Cell Position in Google Spreadsheets | |
// | |
// Install: | |
// 1. Open spreadsheet in Google Drive. | |
// 2. Click Tools->Script editor. | |
// 3. Paste the contents of this file into the text field. | |
// 4. Click Run->install | |
// 5. When prompted for permission, click OK. | |
// 6. Click Run->install a second time. Done! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Kory Becker | |
# http://primaryobjects.com/kory-becker | |
# 4/2015 | |
# | |
# This program solves the Singapore Math Problem, found at http://www.nytimes.com/2015/04/15/science/a-math-problem-from-singapore-goes-viral-when-is-cheryls-birthday.html | |
# The problem is a logic question, where you must deduce the correct birthday from a conversation with two people. The answer is determined through a series of elimination. | |
# Demo: http://www.r-fiddle.org/#/fiddle?id=8zUu1GdT&version=4 | |
# | |
# Original problem: | |
# Albert and Bernard just met Cheryl. "When’s your birthday?" Albert asked Cheryl. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(ggplot2) | |
require(gridExtra) | |
saveChart <- function(chart, fileName) { | |
# Draw attribution. | |
chart <- chart + geom_text(aes(label = 'sentimentview.com', x = 2.5, y = 0), hjust = -2, vjust = 6, color="#a0a0a0", size=3.5) | |
# Disable clip-area. | |
gt <- ggplot_gtable(ggplot_build(chart)) | |
gt$layout$clip[gt$layout$name == "panel"] <- "off" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace BinaryTree | |
{ | |
public class Node | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lda = require('lda'), | |
fs = require('fs'); | |
// Read document (source from random Wikipedia page http://en.wikipedia.org/wiki/Harry_Anderson). | |
fs.readFile('doc.txt', 'utf8', function(err, data) { | |
if (err) { | |
throw err; | |
} | |
else { | |
// Extract sentences. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 Ways to Return Multiple Values with sapply | |
--- | |
Demo at http://www.r-fiddle.org/#/fiddle?id=4pR9ndzC&version=2 | |
Assume we have the following data: | |
Date Value | |
1 2015-05-01 73 | |
2 2015-05-01 94 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Why does this code compile in Visual Studio 2015, but not in Visual Studio 2013? Hmmm? | |
------ | |
VS2013: | |
'EnumTest.Dude.thing.get' must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function refreshTooltips() { | |
// Foundation does not update tooltips from angular dynamically, so we have to rebuild them manually. | |
// Foundation tooltips consist of your added span tag with the tooltip text and a dynamic property "data-selector", which points to the tooltip popover element. | |
// We loop over all tooltip span tags and update their cooresponding popover layer with the span title text. | |
$('span[data-tooltip]').each(function () { | |
// Found a tooltip span tag. | |
var e = $(this); | |
var id = e.data('selector'); | |
var text = e.attr('title'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.configure(function() { | |
// Set the IP and port to use the OpenShift variables. | |
app.set('port', process.env.OPENSHIFT_NODEJS_PORT || process.env.OPENSHIFT_INTERNAL_PORT || process.env.PORT || 3000); | |
app.set('ip', process.env.OPENSHIFT_NODEJS_IP || process.env.OPENSHIFT_INTERNAL_IP || 'localhost'); | |
}); | |
// ... | |
// Set the app.listen to use the port and ip. | |
app.listen(app.get('port'), app.get('ip'), function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>,.,[.,.[<]++++++++++++++++++++++++++++++++++++++++++++.,.,] |