Skip to content

Instantly share code, notes, and snippets.

View timcase's full-sized avatar

Tim Case timcase

View GitHub Profile
@timcase
timcase / prometheus_node.json
Created April 29, 2022 16:44
role for prometheus node
{
"name": "prometheus_node",
"json_class": "Chef::Role",
"default_attributes": {
"twodrops_prometheus": {
"components": {
"node_exporter": {
"install?": true,
"cli_opts": {
"collector.systemd": "",
INSIDE OF .taskrc:
report.monwait.columns=id,start.active,project,tags,wait,wait.remaining,due,until,description
report.monwait.description=tasks sorted by due date ascending
report.monwait.filter=wait:mon
report.tuewait.columns=id,start.active,project,tags,wait,wait.remaining,due,until,description
report.tuewait.description=tasks sorted by due date ascending
report.tuewait.filter=wait:tue
def print_bill
outstanding = 0.0
#print banner
puts "*************************"
puts "******Customer Owes******"
puts "*************************"
# calculate outstanding
@timcase
timcase / DialogMixin.js
Created April 30, 2017 10:05
onSubmit modded to accept state from redux-form
var React = require('react');
var ReactDOM = require('react-dom');
// var $ = require('jquery');
module.exports = {
propTypes: {
onSubmit: React.PropTypes.func.isRequired
},
@timcase
timcase / TextField.js
Created April 30, 2017 10:03
TextField modded to support redux-form Field props
var React = require('react');
module.exports = React.createClass({
displayName: 'TextField',
propTypes: {
label: React.PropTypes.string.isRequired,
value: React.PropTypes.string.isRequired,
},
@timcase
timcase / Create.js
Created April 30, 2017 09:57
Redux form with lore bootstrap create form
var React = require('react');
var DialogMixin = require('../mixins/DialogMixin');
var StringField = require('../fields/StringField');
var TextField = require('../fields/TextField');
var BooleanField = require('../fields/BooleanField');
var NumberField = require('../fields/NumberField');
var _ = require('lodash');
var reduxForm = require('redux-form').reduxForm;
var Field = require('redux-form').Field;
@timcase
timcase / todo.js
Last active April 17, 2017 14:07
Todo mutation
handleCompletedClick = () => {
const originalTodo = Object.assign({}, this.props.todo);
let todo = this.props.todo;
todo.completed = true
this.props.update(todo, originalTodo);
}
export const updateTodo = (todo, originalTodo) => {
const url = 'http://localhost:3001/todos/' + todo.id;
@timcase
timcase / change_spec.rb
Created October 28, 2016 20:27 — forked from nelsonic/change_spec.rb
Coin Change Problem Single Method. Solved in Ruby. Nested until loops. ( requires RSpec) Available coins are USD: http://en.wikipedia.org/wiki/Coins_of_the_United_States_dollar ;-)
class Change
def change(amount)
available_coins = [100,50,25,10,5,1] # http://en.wikipedia.org/wiki/Coins_of_the_United_States_dollar
coins = []
index = 0
coin = available_coins[index]
remaining_amount = amount
until remaining_amount == 0
until remaining_amount >= coin
index = index + 1
​It's 4 days now that I've tried to fix a use case of copying and pasting content blocks and I'm sad to say I don't
have it fixed yet. BUT. Five minutes ago I thought of a good idea that I feel fairly confident is going to work.
The use case:
I've already shown that content blocks can be copied and pasted as content blocks. It's already finished
for the case where a person selects a content block sandwiched between two selections of text. Where it's not finished
is if the the content block appears at the beginning or end of a selection, or if it's a content block
alone that's being selected.
@timcase
timcase / sweet_alert.cjsx
Created July 27, 2016 19:35
NPM integration example
SweetAlert = require('react-swal')
AlertComponent = React.createClass
render: ->
<SweetAlert isOpen={true} type="warning" confirmButtonText="Yup"
cancelButtonText="Nope"/>
module.exports = AlertComponent