# Creating a lambda
l = lambda { |name| "Hi #{name}!" }
# Executing the lambda
l.call("foo") # => Hi foo!
This file contains hidden or 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
| /** | |
| * @providesModule PatientList | |
| */ | |
| import NavigationBar from 'react-native-navbar'; | |
| import NavigationButtons from 'NavigationButtons'; | |
| import React, { ListView, Navigator, StyleSheet, Text, TextInput, TouchableHighlight, View } from 'react-native'; | |
| import { connect } from 'react-redux/native' | |
| @connect(state => ({ | |
| patients: state.patients |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
This file contains hidden or 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
| PASSWORD_VALIDATOR = /( # Start of group | |
| (?: # Start of nonmatching group, 4 possible solutions | |
| (?=.*[a-z]) # Must contain one lowercase character | |
| (?=.*[A-Z]) # Must contain one uppercase character | |
| (?=.*\W) # Must contain one non-word character or symbol | |
| | # or... | |
| (?=.*\d) # Must contain one digit from 0-9 | |
| (?=.*[A-Z]) # Must contain one uppercase character | |
| (?=.*\W) # Must contain one non-word character or symbol | |
| | # or... |
This file contains hidden or 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
| # Convert .wav to .flac | |
| for i in *.wav; do ffmpeg -i "$i" "$i".flac ; done | |
| # Convert .flac to .mp3 (lossless) | |
| for f in *.flac; do ffmpeg -i "$f" -aq 1 "${f%flac}mp3"; done | |
| # Convert .flac to .mp3, compress to ~ 120k | |
| for f in *.flac; do ffmpeg -i "$f" -aq 5 "${f%flac}mp3"; done | |
| # Convert .flac to mp3, compress to ~ 128k |
This file contains hidden or 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
| import { useEffect, useState } from 'react' | |
| import { API, graphqlOperation } from 'aws-amplify' | |
| const ListTalks = ` | |
| query { | |
| listTalks { | |
| items { | |
| name | |
| description | |
| presenter { |
This file contains hidden or 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
| # Stop all containers | |
| docker stop `docker ps -qa` | |
| # Remove all containers | |
| docker rm `docker ps -qa` | |
| # Remove all images | |
| docker rmi -f `docker images -qa ` | |
| # Remove all volumes |
This file contains hidden or 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
| #!/bin/bash | |
| # Requirements: | |
| # - homebrew: https://brew.sh/ | |
| # - homebrew tap: buo/cask-upgrade - https://github.com/buo/homebrew-cask-upgrade | |
| # - homebrew mas (Mac App Store command-line interface - https://github.com/mas-cli/mas) | |
| # Update, upgrade all and cleanup | |
| brew update && brew upgrade && brew cu --all --yes --cleanup && mas upgrade && brew cleanup | |
| # Dump all taps, apps, casks and mac apps into ~/Brewfile |
This file contains hidden or 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
| /* Ultra lightweight Github REST Client */ | |
| // original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb | |
| const token = 'github-token-here' | |
| const githubClient = generateAPI('https://api.github.com', { | |
| headers: { | |
| 'User-Agent': 'xyz', | |
| 'Authorization': `bearer ${token}` | |
| } | |
| }) |