Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Ryan Soileau NoMan2000

View GitHub Profile
@NoMan2000
NoMan2000 / maintenanceLog.flow.jsx
Created Mar 19, 2020
Pagination in a Component
View maintenanceLog.flow.jsx
// @flow
import * as React from 'react';
import { Spinner } from '@blueprintjs/core';
import { SectionWrapper } from '../../commonElements/commonElements';
import SectionHeader from './SectionHeader';
import SectionBody from './SectionBody';
import SectionFooter from './SectionFooter';
type Props = {
customerData: UpdatedCustomerData,
@NoMan2000
NoMan2000 / program.rb
Created Apr 15, 2019
A simple ruby program
View program.rb
p "How many items do you want?"
input = gets.to_i
(1..input).each do |n|
if n % 15 == 0
p "FooBar"
elsif n % 3 == 0
p "Foo"
elsif n % 5 == 0
p "Bar"
@NoMan2000
NoMan2000 / missing_numbers.rb
Created Mar 10, 2019
Ruby code for code kata, solving missing numbers
View missing_numbers.rb
require "test/unit"
NOT_A_NUMBER = 1
ALL_GOOD = 0
def update_previous_value_if_one_ahead(i, prev)
if prev == nil
prev = i.to_i
else
check_value = prev.to_i + 1
@NoMan2000
NoMan2000 / blur.rb
Created Feb 25, 2019
Ruby Image Blur exercise
View blur.rb
require 'test/unit'
# complete for YouTube video.
class Image
attr_accessor :outer_array, :new_outer_array
def initialize(*arr)
@outer_array = arr
end
@NoMan2000
NoMan2000 / readme.md
Last active Jan 13, 2019
Ruby Unique methods
View readme.md

Demo code

This is a quick demo for a student on how to solve a problem in ruby, creating their own built-in version of a ruby method.

@NoMan2000
NoMan2000 / db2.sql
Last active Mar 27, 2018
DB2 debugging statements.
View db2.sql
select * from SYSIBM.TABLES WHERE TABLE_NAME LIKE '%SWPRCRSELP%';
SELECT * FROM SYSIBM;
select r.routinename as FunctionName, r.text as FunctionBody
from syscat.routines r
where r.routinetype = 'F' -- Function
and r.origin in ('U', 'Q'); -- User-defined sourced or query-based
SELECT * FROM SYSIBM.ROUTINES;
@NoMan2000
NoMan2000 / .extensions
Last active Mar 13, 2018
My visual studio settings
View .extensions
abusaidm.html-snippets
benjavr.jshintrc-generator
bitlang.cobol
blanu.vscode-styled-jsx
capaj.vscode-standardjs-snippets
chenxsan.vscode-standardjs
christian-kohler.npm-intellisense
DavidAnson.vscode-markdownlint
dbaeumer.vscode-eslint
EditorConfig.EditorConfig
@NoMan2000
NoMan2000 / observe.js
Created Sep 9, 2017
Converting a regular object to an observable
View observe.js
function convert (obj) {
Object.keys(obj).forEach(key => {
let internalValue = obj[key]
Object.defineProperty(obj, key, {
get () {
console.log(`getting key "${key}": ${internalValue}`)
return internalValue
},
set (newValue) {
console.log(`setting key "${key}" to: ${newValue}`)
@NoMan2000
NoMan2000 / bearclick.js
Last active Aug 25, 2017
Some bear clicking!
View bearclick.js
(function bearClickerStart(global, doc) {
// use strict is a configuration that prevents errors from javascript's older days
'use strict';
// This is the root container that will hold everything else
let parent = doc.querySelector('#bear_insertion');
parent.innerHTML = '';
let bears = [];
// Create five bears
for (let i = 0; i < 5; i += 1 ) {
bears.push('http://placebear.com/g/200/300');
View messed_up.sql
INSERT INTO public.city (id, name, countrycode, district, population) VALUES (1, 'Kabul ', 'AFG', 'Kabol ', 1780000);
INSERT INTO public.city (id, name, countrycode, district, population) VALUES (2, 'Qandahar ', 'AFG', 'Qandahar ', 237500);
INSERT INTO public.city (id, name, countrycode, district, population) VALUES (3, 'Herat ', 'AFG', 'Herat ', 186800);
INSERT INTO public.city (id, name, countrycode, district, population) VALUES (4, 'Mazar-e-Sharif ', 'AFG', 'Balkh ', 127800);
INSERT INTO public.city (id, name, countrycode, district, population) VALUES (5, 'Amsterdam ', 'NLD', 'Noord-Holland ', 731200);
INSERT INTO public.city (id, name, countrycode, district, population) VALUES (6, 'Rotterdam ', 'NLD', 'Zuid-Holland ', 593321);
INSERT INTO public.city (id, name, countrycode, district, popul