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
// Recursive function that loops through each array, adding it's contents to the original until we're out of numbers. | |
const flatten = (integersArray, previousArray) => { | |
// First time it's called there is no second argument, so make that an empty array. | |
const newArray = previousArray || [] | |
// integersArray needs elements or just return previous and exit recursion. | |
if (integersArray && integersArray.length > 0) { | |
integersArray.forEach(i => { | |
// if it's an integer, add it to the returned array. | |
if (typeof i === "number") { | |
newArray.push(i) |
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
var flatten = function(integers_array, flatten_array) { | |
// If this function is called in recursion mode, then we | |
// need to keep previous recursion results. | |
var all_results = flatten_array || []; | |
// We just want to perform any action if there's a | |
// valid array input and this array contains any value in it. | |
if (integers_array && integers_array.length > 0) { | |
integers_array.forEach(function(value) { | |
if (typeof value === 'number') { |
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
module ActionDispatch | |
module Session | |
class CustomFileStore < ActionDispatch::Session::AbstractStore | |
def get_session(env, session_id) | |
session_data = {} | |
session_id ||= generate_sid | |
File.open(tmp_file(session_id),'r') do |f| | |
data = f.read | |
session_data = ::Marshal.load(data) unless data.empty? | |
end rescue nil |
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
<link rel="import" href="../core-scaffold/core-scaffold.html"> | |
<link rel="import" href="../core-header-panel/core-header-panel.html"> | |
<link rel="import" href="../core-menu/core-menu.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../topeka-elements/avatars.html"> | |
<link rel="import" href="../core-icon/core-icon.html"> | |
<link rel="import" href="../core-menu/core-submenu.html"> | |
<link rel="import" href="../core-icons/core-icons.html"> |
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
/* | |
Fix for Neosmart's fbWall JQuery Plugin. | |
http://www.neosmart.de/social-media/facebook-wall | |
after facebook required an access token. Stated here. | |
http://developers.facebook.com/blog/post/510 | |
Hope everyone at home can follow along. | |
*/ | |
// Using the Javascript SDK, you get login status. Works with FB.login() this same way. |