Skip to content

Instantly share code, notes, and snippets.

View mnichols's full-sized avatar

Mike Nichols mnichols

View GitHub Profile
var fizzBuzzCustom = function(stringOne, stringTwo, numOne, numTwo) {
stringOne = stringOne || 'Fizz';
stringTwo = stringTwo || 'Buzz';
numOne = numOne || 3;
numTwo = numTwo || 5;
var ret = []
for (var i = 1; i <= 100; ++i) {
if (i % numOne === 0 && i % numTwo === 0) {
ret.push(stringOne + stringTwo);
@mnichols
mnichols / invc-sam-mithril-component.js
Last active October 2, 2017 19:54
component structure
import m from 'mithril'
import { curry } from 'ramda'
const createActions = ({ update }) => {
return {
someBehavior ({ id }) {
update(m => { m.someId = id })
}
}
}
{
"_links": {
"self": {},
"context": {}
},
"timestamp": "string",
"contextIds": [
"string"
],
"_embedded": {

Basic - intermediate JS exercises

  1. What value is now stored in the variable name?
var isKing = true;
var name = isKing ? ‘Arthur’ : ‘Hank’;
  1. What is the difference between == and === in Javascript?
var contextReadModel = {
type: string,
clientId: string,
contextId: string,
ref: {
type: string,
clientId: string,
contextId: string
},
var model = {
apiRootUrl: string,
context,
contextRefs: [{
contextId: string,
type: string,
clientId: string
}],
initialized: boolean,
user: {
import m from 'mithril'
import stream from 'mithril/stream'
import {
curry,
compose,
merge,
over,
lensPath,
lift,
pick,
/* global beforeEach describe it */
import { assert } from 'chai'
import m from 'mithril'
import mq from 'mithril-query'
import stream from 'mithril/stream'
import { compute, connect, scope, combine } from '../src/index.js'
function SimpleComponent ({ update }) {
return {
{
"identity": {
"id": "147d2194-8045-4084-5c43-94abaaf1804a",
"name": "noworky",
"authorId": 1,
"edition": 1,
"pageId": "eb842147-5e40-4773-bfb8-d04a0782500b",
"thumbnailUrl": "https://in.local.invision.works/assets/user_1_presentation_147d2194-8045-4084-5c43-94abaaf1804a_thumbnails_edition_1_76ccc4ce07acd3fa7ea1798b3fcc6e52f7bd9f30"
},
"permissions": {
def clean_slate(record, name)
name_parts = name.split(/\s+/)
name_parts.each do |part|
record.gsub!(/\b#{part}\b/i,"XX" * name.length)
end
return record
end