Skip to content

Instantly share code, notes, and snippets.

View lawwantsin's full-sized avatar
Working from home

Lawrence Whiteside lawwantsin

Working from home
View GitHub Profile
lawwantsin / flatten.js
Created November 26, 2017 18:17
Recursive Array Flattener
// 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") {
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') {

TodoMVC React

SCSS Style Guide

###File Structure

This is an example of a component named quote.

├── application.scss
lawwantsin / custom_file_store.rb
Created October 31, 2015 04:35 — forked from bradpauly/custom_file_store.rb
simple file store for rails sessions
module ActionDispatch
module Session
class CustomFileStore < ActionDispatch::Session::AbstractStore
def get_session(env, session_id)
session_data = {}
session_id ||= generate_sid,'r') do |f|
data =
session_data = ::Marshal.load(data) unless data.empty?
end rescue nil
lawwantsin / designer.html
Last active August 29, 2015 14:15
<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">
lawwantsin / fbwallfix.js
Created June 6, 2011 04:31
Fix for Neosmart's fbWall JQuery Plugin.
Fix for Neosmart's fbWall JQuery Plugin.
after facebook required an access token. Stated here.
Hope everyone at home can follow along.
// Using the Javascript SDK, you get login status. Works with FB.login() this same way.