Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Esther Leytush mindplace

🎯
Focusing
View GitHub Profile
@mindplace
mindplace / lovely_filename.py
Created Jul 28, 2020
Example for wrapping commands with a specific language version
View lovely_filename.py
#!/usr/local/bin/python3.4
import sys
import wireviz
passed_in_file = sys.argv[0]
wireviz passed_in_file
@mindplace
mindplace / ruby_blocks.rb
Created Feb 11, 2020
Messing around with blocks
View ruby_blocks.rb
require 'pry'
array = ['a', 'b', 'c', 'd']
class Array
def my_map(extra_word, &block)
new_array = []
self.each do |item|
new_array << extra_word + block.call(item) + extra_word
end
@mindplace
mindplace / java_output.txt
Created Apr 26, 2019
output after running `gradle clean assemble && java -jar build/libs/*.jar`
View java_output.txt
2019-04-26 15:18:29.507 request_id= job_name= WARN 17399 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext-foundation.xml]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'batchAppGraphiteMetricsClient' for bean class [com.betterment.common.metrics.BatchAppGraphiteMetricsClient] conflicts with existing, non-compatible bean definition of same name and class [com.betterment.metrics.BatchAppGraphiteMetricsClient]
2019-04-26 15:18:29.514 request_id= job_name= ERROR 17399 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception
java.lang.IllegalStateExcept
@mindplace
mindplace / numDistinct.js
Created Feb 20, 2019
going through solving a JS problem together
View numDistinct.js
// Pseudocode a function that returns the number of distinct values in an input array.
//
// numDistinct([1, 2, 2, 3])
// >> 3
// Clarify
// check if empty or not => you will never have no argument passed
// very large array? or smaller, or medium? How many numbers normally? => 3 - 100 numbers
// will the inputs all be integers, or will they be other things as well? => numbers
@mindplace
mindplace / email.html
Created Jan 12, 2019
Email changer based on the browser URL
View email.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Email Changer</title>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
</head>
View something.md
class Employee
 #Begin attribute reader / writer
 attr_reader :first_name, :last_name
 attr_writer :first_name, :last_name
 #end attribute reader / writer
end #end of class Employee
###
employee1 = Employee.new #declare new employee
employee1.first_name = "Thomas" 
@mindplace
mindplace / lovely_class.rb
Created Dec 2, 2018
Using 'let' in RSpec
View lovely_class.rb
require 'rspec'
class LovelyClass
def lovely_method(something:)
p something
end
end
RSpec.describe LovelyClass do
let(:lovely_instance) { LovelyClass.new }
View ansible.bash
alias prod-encrypt="pbpaste |
ansible-vault encrypt_string
--vault-password-file=~/ansible-vault/production.key"
@mindplace
mindplace / substring_with_regex.js
Created Jan 11, 2018
substring solved with a regular expression
View substring_with_regex.js
function isSubstring(str, char, length) {
var seekingPattern = char.repeat(length),
regexp = new RegExp(seekingPattern, "gi");
var foundMatch = !!(str.match(regexp) && str.match(regexp).length > 0);
return foundMatch;
}
View package.json
{
"name": "new-react",
"version": "0.1.0",
"private": true,
"scripts": {
"build-css": "node-sass-chokidar src/ -o src/",
"watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive",
"start": "npm-run-all -p watch-css start-js",
"build": "npm-run-all build-css build-js",
"start-js": "react-scripts start",