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
| // Lambda S3 Zipper | |
| // http://amiantos.net/zip-multiple-files-on-aws-s3/ | |
| // | |
| // Accepts a bundle of data in the format... | |
| // { | |
| // "bucket": "your-bucket", | |
| // "destination_key": "zips/test.zip", | |
| // "files": [ | |
| // { | |
| // "uri": "...", (options: S3 file key or URL) |
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
| title: Energia | |
| icon: mdi:transmission-tower | |
| path: energy | |
| background: var(--background-image) | |
| cards: | |
| - type: vertical-stack | |
| cards: | |
| - type: horizontal-stack | |
| cards: | |
| - type: entities |
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
| # 15m after the sunrise | |
| # - Open the covers | |
| # - Turn off ligths | |
| - id: sunrise | |
| alias: 'Sunrise automation' | |
| trigger: | |
| - platform: sun | |
| event: sunrise | |
| offset: '00:15:00' | |
| action: |
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
| // content of index.js | |
| const http = require('http') | |
| const port = 3000 | |
| const requestHandler = (request, response) => { | |
| console.log("URL: %s", request.url) | |
| if (request.method === 'POST') { | |
| let body = ''; | |
| request.on('data', chunk => { | |
| body += chunk.toString(); // convert Buffer to string |
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 _ from 'lodash'; | |
| export default function toCamelCase(obj) { | |
| if (!_.isObject(obj)) { return obj; } | |
| if (_.isArray(obj)) { | |
| return obj.map(toCamelCase); | |
| } | |
| return _.reduce(obj, (memo, value, key) => { |
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
| '.source.js': | |
| 'Describe': | |
| 'prefix': 'desc' | |
| 'body': 'describe(\'$1\', function () {\n\tit(\'$2\', function () {\n\t\t$3\n\t});\n});' | |
| 'Test': | |
| 'prefix': 'it' | |
| 'body': 'it(\'$1\', function () {\n\t$2\n});' | |
| 'Before Each': | |
| 'prefix': 'be' | |
| 'body': 'beforeEach(function () {\n\t$1\n});' |
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
| var Logger = require('logger-facade-nodejs'); | |
| var LoggerConsolePlugin = require('logger-facade-console-plugin-nodejs'); | |
| // this is the default config | |
| var config = { | |
| level: 'debug', | |
| timeFormat: 'YYYY-MM-DD HH:mm:ss', | |
| messageFormat: '%time | %logger::%level - %msg', | |
| json: true | |
| }; |
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
| Sam Newman - Building Microservices | |
| http://shop.oreilly.com/product/0636920033158.do | |
| Sam Newman podcast with Beth Skurrie about: | |
| - microservices | |
| - vanila rails codebase issues on larger codebases | |
| - contract driven tests vs system integration tests | |
| - pact | |
| http://samnewman.io/blog/2015/12/16/magpie-talkshow-episode-8-beth-skurrie/ |
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
| mkdir -p /tmp/downloaded_files | |
| while IFS='' read -r line || [[ -n "$line" ]]; do | |
| #echo "Text read from file: $line" | |
| filename=$(echo $line | cut -d "," -f 1) | |
| url=$(echo $line | cut -d "," -f 2) | |
| echo "url: $url filename: $filename" | |
| curl $url -o "/tmp/downloaded_files/$filename" | |
| done < "$1" |
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 User | |
| attr_reader :born_on | |
| def age(today = Time.now.utc) | |
| return nil unless self.born_on.present? | |
| ((today.to_time - self.born_on.to_time) / 1.year).to_i | |
| end | |
| end |
NewerOlder