View pre-push
This file contains 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 | |
protected_branch='master' | |
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
if [ $protected_branch = $current_branch ] | |
then | |
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty | |
echo | |
if echo $REPLY | grep -E '^[Yy]$' > /dev/null |
View controller.rb
This file contains 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
bucket = Aws::S3::Bucket.new(name: 'truck-parts') | |
@signed_upload_url = bucket.presigned_post( | |
key: 'public/${filename}', | |
success_action_status: '201', | |
acl: 'public-read', | |
signature_expiration: 1.minute.from_now | |
) |
View index.html
This file contains 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
<form id="form1" runat="server"> | |
<input type='file' id="imgInp" multiple='true' /> | |
<div id="preview"></div> | |
</form> |
View hotel review
This file contains 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 lines = input.split('\n'); | |
var wordlist = lines[0]; | |
var wordScoresDict = {}; | |
wordlist.map(word => wordScoresDict[word.toLowerCase()] = 0); | |
var hotels = []; | |
for (var i = 0, l = lines.length; i < l; i++) { |
View Timezone Hash
This file contains 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
displayedTimezones = | |
"Pacific/Midway" : "International Date Line West" | |
"Pacific/Midway" : "Midway Island" | |
"Pacific/Pago_Pago" : "American Samoa" | |
"Pacific/Honolulu" : "Hawaii" | |
"America/Juneau" : "Alaska" | |
"America/Los_Angeles" : "Pacific Time (US & Canada)" | |
"America/Tijuana" : "Tijuana" | |
"America/Denver" : "Mountain Time (US & Canada)" | |
"America/Phoenix" : "Arizona" |
View time-picker.css
This file contains 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
.timePicker { | |
list-style-type: none; | |
background-color: #fff; | |
width: 80px; | |
margin: 0; | |
padding: 0; | |
height: 200px; | |
overflow-y: auto; | |
box-shadow: 1px 1px 3px rgba(0,0,0,0.4); | |
font-family: sans-serif; |
View time-picker.html
This file contains 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
<div class="timePickerWrap"> | |
<input ng-model="time" class="timePickerInput" type="text"> | |
<ul ng-show="showTimeDropdown" class="timePicker"> | |
<li>0:00 AM</li> | |
<li>0:30 AM</li> | |
<li>1:00 AM</li> | |
<li>1:30 AM</li> | |
<li>2:00 AM</li> | |
<li>2:30 AM</li> | |
<li>3:00 AM</li> |
View timePicker.js
This file contains 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.directive('timePicker', function(){ | |
return { | |
restrict: 'A', | |
replace: true, | |
scope: { | |
time: '=' | |
}, | |
templateUrl: 'js/partials/time-picker.html', | |
link: function(scope, el, attr){ | |