#Object Oriented Javascript
#Overview
- Creating Objects in JavaScript
new Object();
- Object Literal Notation (Important)
- Factory Function
- Review JavaScript's
this
- More Creating Objects in JavaScript
- Constructor Function
class Queue | |
def initialize(max_size=nil) | |
@store = [] | |
@max_size = max_size | |
end | |
def push(x) | |
raise "Queue Overflow - The queue is full" if self.full? | |
@store.push x | |
end |
#Object Oriented Javascript
#Overview
new Object();
this
def find_possible_series(number) | |
possible_series = [] | |
split_number = number.to_s.split('') | |
while split_number.length > 13 | |
split_number.map!{|i| i.to_i}.each_slice(13) do |slice| | |
if slice.include?(0) == false | |
possible_series << slice | |
end | |
end | |
split_number.delete_at(0) |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
do -> | |
class StateMap | |
constructor: -> | |
# Switch county boundary map based on state page | |
@countyBoundaries = <%= asset_path("county_boundaries/TX.geojson").inspect %> | |
@settings = {scrollWheelZoom: false} | |
@accessToken = L.mapbox.accessToken = 'pk.eyJ1IjoiZGFzY2hpIiwiYSI6IjcxOWE1Njc3OTVmMDY4NDEzYmRmMmVjNTRjMDE5MTdhIn0.1-E1xWlLuCMa3X8BRvN1Rg' | |
@map = new L.mapbox.map('map', 'mapbox.streets-basic', @settings) |
#= require jquery | |
#= require typehead.js | |
$(document).ready -> | |
window.typeahead.init() | |
window.typeahead = { | |
###################### | |
# INITIALIZATION STUFF |
sheet = Roo::Excelx.new('roo_link_example.xlsx').sheet(0) | |
headers = sheet.row(1) | |
sheet.each_row_streaming(offset: 2, pad_cells: true) do |row| | |
data = Hash[headers.zip(row)] | |
end | |
# data['embedded_link'].link | |
# => true | |
# data['embedded_link'].value |
let newStuff; | |
export const filter = array => { | |
return { | |
with: (...functions) => { | |
return functions.reduce((results, filterFunction) => { | |
return results.filter(filterFunction); | |
}, array); | |
} | |
}; | |
}; |
license: mit |
import React, { useEffect } from "react"; | |
import { getFacilities, deleteFacility, saveFacility } from "../database"; | |
import { Facilities, Facility } from "../page-multi-facility/types"; | |
import useScenario from "../scenario-context/useScenario"; | |
type FacilityMapping = { [key in Facility["id"]]: Facility } | |
export interface FacilitiesState { | |
loading: boolean; |