View Detect_Pangram.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://www.codewars.com/kata/545cedaa9943f7fe7b000048/train/ruby | |
def panagram? str | |
chars_only = ->(string) {string.split('').map(&:downcase).uniq.select{ |c| c =~ /[[:alpha:]]/ }} | |
chars_only[str].size.eql? 26 | |
end | |
def panagram?(string) | |
('a'..'z').all? { |x| string.downcase.include? (x) } | |
end |
View give_me_a_diamond.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
https://www.codewars.com/kata/5503013e34137eeeaa001648/train/ruby | |
Give me a Diamond | |
Jamie is a programmer, and James' girlfriend. She likes diamonds, and wants a diamond string from James. Since James doesn't know how to make this happen, he needs your help. | |
Task | |
You need to return a string that looks like a diamond shape when printed on the screen, using asterisk (*) characters. Trailing spaces should be removed, and every line must be terminated with a newline character (\n). | |
Return null/nil/None/... if the input is an even number or negative, as it is not possible to print a diamond of even or negative size. |
View consonant_value_add.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Given a lowercase string that has alphabetic characters only and no spaces, return the highest value of consonant substrings. Consonants are any letters of the alpahabet except "aeiou". | |
We shall assign the following values: a = 1, b = 2, c = 3, .... z = 26. | |
For example, for the word "zodiacs", let's cross out the vowels. We get: "z o d ia cs" | |
-- The consonant substrings are: "z", "d" and "cs" and the values are z = 26, d = 4 and cs = 3 + 19 = 22. The highest is 26. | |
solve("zodiacs") = 26 |
View consonant_value_add.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Given a lowercase string that has alphabetic characters only and no spaces, return the highest value of consonant substrings. Consonants are any letters of the alpahabet except "aeiou". | |
We shall assign the following values: a = 1, b = 2, c = 3, .... z = 26. | |
For example, for the word "zodiacs", let's cross out the vowels. We get: "z o d ia cs" | |
-- The consonant substrings are: "z", "d" and "cs" and the values are z = 26, d = 4 and cs = 3 + 19 = 22. The highest is 26. | |
solve("zodiacs") = 26 |
View matchingPairs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = 7 | |
arr = [ 1,2,1,2,1,3,2 ] | |
def matchingPairs(qty,socks): | |
pairs = 0 | |
counts = {} | |
for s in socks: | |
if s in counts: | |
counts[s] += 1 |
View marvelous_monadic_mischief.elm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing (main) | |
import Browser | |
import Html exposing (Html, button, div, text) | |
import Html.Events exposing (onClick) | |
type alias Model = | |
{ count : Int } |
View intersectionOfPlaces.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sometimes, we get data that is not fully populated | |
# eg Boston <> New York appears, and so does New York <> Boston, | |
# but Berlin <> Munich appears, though not Munich <> Berlin | |
locations = { | |
'new york' => [ 'boston', 'philly' ], | |
'boston' => [ 'new york' ], | |
'philly' => [ 'new york' ], | |
'paris' => [ 'amsterdam', 'berlin' ], | |
'berlin' => [ 'paris', 'munich' ], | |
'amsterdam' => [], |
View .vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"this is the .vimrc for the mac terminal... | |
" important, let mapleader has to go first here.. | |
"Sun Mar 3 19:30:06 2013 | |
" execute pathogen#infect() | |
"set nowrap | |
let mapleader="," | |
"Thu Feb 18 16:31:32 EST 2016 |
View gist:2011138b1b2a8411d8911853603f8d52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// © 2011 Artem Sapegin http://sapegin.ru | |
// Simple CSS3 properties with vendor prefixes | |
box-sizing() | |
-moz-box-sizing arguments | |
box-sizing arguments | |
box-shadow() | |
-webkit-box-shadow arguments |
View MultiSelect.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Material UI multi select | |
* | |
* Use with: | |
* <MultiSelect fullWidth={true} value={this.state.values} onChange={(e,v) => this.setState({values: v})}> | |
* <ListItem primaryText={"Option 1"} value={1} /> | |
* <ListItem primaryText={"Option 2"} value={2} /> | |
* <ListItem primaryText={"Option 3"} value={3} /> | |
* <ListItem primaryText={"Option 4"} value={4} /> | |
* </MultiSelect> |
NewerOlder