# 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
Show hidden characters
| { | |
| "presets": ["es2015"], | |
| "plugins": [ | |
| "add-module-exports" | |
| ], | |
| } |
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
| def split_string(str) | |
| result = [] | |
| str = str + "_" if str.length.odd? | |
| len = str.length / 2 | |
| for i in 0..len-1 | |
| arry = str[2*i, 2] | |
| result << arry | |
| end | |
| result.to_a | |
| end |
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 React from 'react'; | |
| import { Text, View, SafeAreaView, FlatList, WebView, Dimensions, Button, ScrollView} from 'react-native'; | |
| import { ListItem } from 'react-native-elements'; | |
| import ApolloClient from "apollo-boost"; | |
| import gql from "graphql-tag"; | |
| import { ApolloProvider } from "react-apollo"; | |
| import { Query } from "react-apollo"; | |
| import HTML from 'react-native-render-html'; | |
| import { createAppContainer, createStackNavigator} from 'react-navigation'; |
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
| class Array | |
| def splice(start, len, *replace) | |
| self[start, len] = replace | |
| self | |
| end | |
| end | |
| ruby-1.8.7-p352 :008 > initial_array = [:a, :c, :h, :g, :t, :m] | |
| => [:a, :c, :h, :g, :t, :m] | |
| ruby-1.8.7-p352 :009 > initial_array.splice(2, 2, :test) |
UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.
Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/
sudo amazon-linux-extras install docker
sudo service docker start
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
| # Load DSL and set up stages | |
| require "capistrano/setup" | |
| # Include default deployment tasks | |
| require "capistrano/deploy" | |
| # Load the SCM plugin appropriate to your project: | |
| # | |
| # require "capistrano/scm/hg" | |
| # install_plugin Capistrano::SCM::Hg |
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
| # app/graphql/types/objects/document_type.rb | |
| module Mutations | |
| class CreateDocument < BaseMutation | |
| description "creates a document for the user in the system" | |
| argument :doc, ApolloUploadServer::Upload, required: true | |
| field :document, Types::Objects::DocumentType, null: false |
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
| # Generate Random Passwords | |
| curl 'https://www.random.org/passwords/?num=2&len=24&format=plain&rnd=new' | |
| # Create deploy user | |
| sudo adduser deploy | |
| sudo adduser deploy sudo | |
| su deploy | |
| cd ../deploy/ | |
| mkdir .ssh | |
| touch .ssh/authorized_keys |