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 soma(p1, p2) | |
| p1 + p2 | |
| end | |
| def substrai(p1, p2) | |
| p1 - p2 | |
| end | |
| def multiplica(p1, p2) | |
| p1 * p2 |
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
| #include <ESP8266WiFi.h> | |
| #include <PubSubClient.h> | |
| // MQTT | |
| #define MQTT_BROKER "10.0.0.1" //MOSQUITTO IP | |
| #define MQTT_BROKER_PORT 1883 | |
| #define MQTT_ID "ID" //UNIQUE MOSQUITTO THING ID | |
| #define MQTT_PRIVATE_TOPIC "iot/office/"MQTT_ID | |
| #define MQTT_BROADCAST_TOPIC "iot/office" |
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
| Array.prototype.slice.call(document.querySelectorAll('.book')).map(function(e) { | |
| var details = e.childNodes[0].childNodes[1], | |
| actions = e.childNodes[1], | |
| title = details.childNodes[0].textContent.replace(/;/g,','), | |
| author = details.childNodes[1].textContent.replace(/;/g,','), | |
| situation = actions.hasChildNodes() ? 'DISPONIVEL' : 'LOCADO'; | |
| return [title, author, situation]; | |
| }).sort(function(a, b) { | |
| return a[0].localeCompare(b[0]); | |
| }).map(function(v) { |
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
| Array.from(document.querySelectorAll('.markdown-body li a')) | |
| .map((el) => el.textContent.match(/.*\★(\d+)$/)) | |
| .filter((match) => match) | |
| .filter((match) => parseInt(match[1]) > 500) | |
| .sort((m1, m2) => parseInt(m2[1]) - parseInt(m1[1])) | |
| .map((match) => match[0]) | |
| .forEach((entry) => console.log(entry)); |
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
| (function() { | |
| var container = $('.fc thead'); | |
| var cloneHead = $('<tr class="fc-first fc-last cloned-head"></tr>').css({ | |
| zIndex: 5, | |
| display: 'none' | |
| }).appendTo(container); | |
| $('#schedule thead th').each(function() { | |
| var cloned = $(this).clone(); | |
| cloned.css('width', $(this).outerWidth()); |
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/sh | |
| # | |
| # description: ServiceName | |
| # chkconfig: 2345 99 89 | |
| # | |
| # Source function library. | |
| . /etc/rc.d/init.d/functions | |
| APP_NAME='ServiceName' | |
| APP_DIR='/opt/service_dir' |
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
| (function() { | |
| var messages = Array.prototype.slice.call(document.getElementsByClassName('adO')); | |
| var emails = messages.map(function(m) { | |
| return m.childNodes[0].getElementsByTagName('a')[1].getAttribute('href').replace('mailto:', ''); | |
| }); | |
| var hist = {}; | |
| emails.map( function (a) { if (a in hist) hist[a] ++; else hist[a] = 1; } ); | |
| console.log(hist); | |
| })(); |
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
| sudo apt-get install postgresql postgresql-client postgresql-contrib postgresql-server-dev-all | |
| gem install pg |
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
| $ npm test | |
| > static-server@1.1.0 test /home/ebohrer/projects/static-server | |
| > mocha | |
| StaticServer test | |
| ✓ should fail if rootPath is unspecified | |
| ✓ should expose the http STATUS_CODES object |
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/sh | |
| # Inspired by this gist https://gist.github.com/simonewebdesign/8507139 changing link from subl to sub and downloading the latest ST version. | |
| # Sublime Text 3 (3065) install with Package Control | |
| # Run this script with: | |
| # $ curl <link> | sh | |
| curl -o ~/st3.tar.bz2 http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3083_x64.tar.bz2 | |
| if tar -xf ~/st3.tar.bz2 --directory=$HOME; then |
NewerOlder