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 | |
| read -p $'Github \e[31musername\e[0m: ' user | |
| echo -n $'Github \e[31mpassword\e[0m: ' | |
| read -s pass | |
| echo '' | |
| read -p $'Repository \e[31mowner\e[0m: ' owner | |
| read -p $'The \e[31mrepository\e[0m: ' repo | |
| function add_label { |
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
| module ModuleToBeIncludedByParentClass | |
| def parent; puts 'from included module by parent'; super if defined?(super); end | |
| end | |
| module ModuleToBeExtendedByParentClass | |
| def parent; puts 'from extended module by parent'; super if defined?(super); end | |
| end | |
| module ModuleToBeIncludedByChildClass | |
| def child; puts 'from included module by child'; super if defined?(super); end | |
| 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
| Calculating ------------------------------------- | |
| array 45.561k i/100ms | |
| regexp 48.843k i/100ms | |
| ------------------------------------------------- | |
| array 711.188k (± 5.8%) i/s - 3.554M | |
| regexp 797.338k (± 5.9%) i/s - 4.005M | |
| Comparison: | |
| regexp: 797337.6 i/s | |
| array: 711187.6 i/s - 1.12x slower |
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 | |
| mux() { | |
| if [ -z "$@" ]; then | |
| echo 'usage ./tmux.sh <project_name> [<project2]'; | |
| fi | |
| for project in "$@"; do | |
| cd ${project}; |
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 | |
| name=$1; | |
| if [ -z "${name}" ]; then | |
| echo 'usage ./small-ruby <name>'; | |
| exit 1; | |
| fi | |
| mkdir ${name} |
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
| { | |
| Elevator: function(elevator) { | |
| this.bindEvents = function() { | |
| elevator.on("idle", function() { | |
| elevator.goToFloor(0); | |
| }); | |
| elevator.on("floor_button_pressed", function(floorNum) { | |
| elevator.goToFloor(floorNum); | |
| }); | |
| }; |
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
| // 1. Add Bootstrap as a dependency in package.json | |
| { | |
| ... | |
| "dependencies": { | |
| ... | |
| "bootstrap": "~3.3.6" | |
| } | |
| } |
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
| # remove unwanted files: | |
| find . -type f -name 'index.html' -print0 | xargs -0 echo | |
| for f in * ; do echo "f='${f}'"; tar -czf ${f}.tar.gz ${f}; done; |
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
| # https://www.npmjs.com/package/npm-check-updates | |
| bower install --save ember#release | |
| npm install --save-dev emberjs/data#release | |
| npm outdated | |
| ncu | |
| ncu -a | |
| ncu -u | |
| npm install |
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
| Date.prototype.advanceDays = function(days) { | |
| let d = new Date(this); | |
| return new Date(d.setDate(this.getDate() + days)); | |
| }; | |
| Date.prototype.beginningOfWeek = function() { | |
| return this.advanceDays((this.getDay() == 0 ? -6 : 1) - this.getDay()); | |
| }; | |
| Date.prototype.getWeekName = function() { | |
| return ['S', 'M', 'T', 'W', 'T', 'F', 'S'][this.getDay()]; |
OlderNewer