This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am shiggiddie on github. | |
* I am shiggiddie (https://keybase.io/shiggiddie) on keybase. | |
* I have a public key ASAUMzmuLKaZLU7s-KvZ8pWfmMUxiTNkRaxNif-k-dkg0Ao | |
To claim this, I am signing this object: |
This file contains 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 Xamarin.Forms; | |
using System.Windows.Input; | |
using System.Collections.Generic; | |
using System.Runtime.CompilerServices; | |
using System.ComponentModel; | |
using System.Threading.Tasks; | |
[assembly: | |
InternalsVisibleTo ("TwinTechsLib.iOS"), |
This file contains 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
// Ideally one would get user information from onEdit using onEdit's event's .user attribute, | |
// however GAS does not give authorization to do so for the onEdit function (without some minor caveats). | |
// The following subverts this slightly by allowing the user to include their own user information that is | |
// then stored on the user's properties for the file/script. | |
function onEdit(e) { | |
var user = PropertiesService.getUserProperties().getProperty('user'); | |
if (!user) { | |
var ui = SpreadsheetApp.getUi(); | |
while (!user) { |
This file contains 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
/* | |
* The purpose of this excercise was to understand how to preserve a session | |
* using only request-promise (https://www.npmjs.com/package/request-promise) | |
* | |
* USAGE: | |
* | |
* Grab dependencies: | |
* $ npm --save request | |
* $ npm --save request-promise | |
* |
This file contains 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
// Problem: given an array of elements, create the array function to turn that array into | |
// a string that will represent an html table containing the array elements, one element per row, | |
// with each element appended with "foo" | |
// E.g. The following array... | |
var arr = ["hi", "bye", "todo", "fly"]; | |
// ...becomes: | |
// <html> | |
// <body> | |
// <table> |
This file contains 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
# 1) Make necessary modifications to a rails project such that an HTML response of "<h1>Hello World</h1>" | |
# is returned when hitting the path "/hello_world/index" with a GET request | |
# 2) Devise a shell utility "curl" command that makes a GET request of the path constructed in #1 | |
# 3) Make necessary modifications to the rails project such that an HTML response of "<h1>Hello POST world</h1>" | |
# is returned when hitting the path "/hello_world/index" with a POST request, do not remove any code created in #1 | |
# 4) Devise a shell utility "curl" command that makes a POST request of the path constructed in #2 |
This file contains 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
After porting beer_me to a mean.js app, I kept seeing "exports": e.g. "exports.foo = function() {console.log('hi');}" | |
I assumed this had something to do with the way the functions were exposed elsewhere in a mean.js app's codebase. | |
This assumption was fairly correct, and confirmed after reading: http://www.sitepoint.com/understanding-module-exports-exports-node-js/ | |
I do not understand this line: https://github.com/cpww/beer_me/blob/master/app/controllers/users.server.controller.js#L11 | |
Where does the ".extend" method come from? | |
So the var "_" is assined the module.exports object from "lodash". | |
Therefore "_.extend" is accessing the "extend" function from within the "lodash" module. |
This file contains 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
//1) Fix computer algorithm (assigning to Anth) | |
// In Player's .makeMove method: | |
if (index == null) { | |
// No block? Try for center... | |
//console.log('computer is attempting to center'); | |
if (grid.vectors[4].value == null) { | |
index = 4; | |
} | |
} |
This file contains 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
/* | |
Background: | |
- The Grid object has an array of Vector objects accessible in the Grid's "vectors" attribute | |
- A Vector object has a "value" attribute that contains "O", "X", or null if not set | |
- The checkForWin method on the Grid returns true if and only if there is a win state in tic-tac-toe | |
* The win state is determined by looping through all the various winCombos, where winCombos is an array of arrays, whose inner arrays represent the 3 indexes of the Grid's "vectors" array that refer to row, collumn, or diagonal on a tic-tac-toe board which -if all containing the same Vector "value" value- constitutes a win. | |
*/ | |
// Elegant, non-performant |
This file contains 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
// Month Names | |
var monthName = function() { | |
var names = ["January", "February", "March", "April", "May", | |
"June", "July", "August", "September", "October", | |
"November", "December"]; | |
return { | |
name: function(number) { return names[number]; }, | |
number: function(name) { return names.indexOf(name); } | |
}; | |
}(); |
NewerOlder