Skip to content

Instantly share code, notes, and snippets.

View doritostains's full-sized avatar

Adrian Del Campo doritostains

View GitHub Profile
@doritostains
doritostains / machine.js
Last active March 19, 2020 13:53
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@doritostains
doritostains / machine.js
Last active March 18, 2020 09:30
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// 2. Given the following wheels and categories. Write a function named “wheelsWithCategories”
// that produces the result below.
const wheels = {
wheels: [
{
wheelID: 1,
wheelCategory: 'OffRoad'
wheelName: 'OffRoad One'
},
// 1. Given an array of five integers in ascending order,
// write a function called “transform” that takes the array,
// multiplies each integer by 10, and produces a new array
// of strings in descending order.
let items = [1, 2, 3, 4, 5];
// Output
console.log(transform(items));
@doritostains
doritostains / update-values.clj
Last active August 29, 2015 14:03
Replaces all values in a map with the results of a function
(require '[clojure.walk :as walk])
(defn update-values
"Replaces all values in a map with the results of a function"
[m f & args]
(let [f (fn [[k v]] (if (map? v) [k v] [k (apply f v args)]))]
(walk/prewalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)))
(update-values {:a 1 :b 1} + 10)
@doritostains
doritostains / Gloom.itermcolors
Created July 4, 2013 04:32
iTerm 2 port of Gloom color scheme by Dayle Rees
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.073354568467785999</real>
<key>Green Component</key>
<real>0.081447963800905021</real>
@doritostains
doritostains / Contrast-Gloom.itermcolors
Last active December 19, 2015 08:19
iTerm 2 port of Contrast Gloom color scheme by Dayle Rees
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.098313517868518829</real>
<key>Green Component</key>
<real>0.11400297284126282</real>
# Deployment uses SFTP by default when you use deploy_via :copy, and there
# doesn't seem to be any way to configure it. Unfortunately, we don't run
# SFTP on our servers, so it fails. This forces it to use SCP instead.
# http://www.capify.org/index.php/OverridingTaskCommands
#
module UseScpForDeployment
def self.included(base)
base.send(:alias_method, :old_upload, :upload)
base.send(:alias_method, :upload, :new_upload)
end
@doritostains
doritostains / capistrano_torquebox_deploy.rb
Created January 12, 2013 06:05
Capistrano deployment-descriptor, for torquebox, output fix. The default task outputs backslashes at the end of every line of the descriptor.
namespace :deploy do
namespace :torquebox do
task :deployment_descriptor do
puts "creating deployment descriptor"
dd_str = YAML.dump_stream( create_deployment_descriptor(latest_release) )
dd_file = "#{jboss_home}/standalone/deployments/#{application}-knob.yml"
deploy_knob = ""
dd_str.each_line do |line|
deploy_knob << line
end