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
jack in /U/j/p/a/maintenance_scripts on master [!] | |
$ python sat6_report.py | |
Traceback (most recent call last): | |
File "sat6_report.py", line 6, in <module> | |
import requests | |
ImportError: No module named requests | |
jack in /U/j/p/a/maintenance_scripts on master [!] | |
$ pip list | grep requests | |
requests 2.10.0 |
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
#!/usr/bin/env ruby | |
# The naive approach | |
input = "R5, R4, R2, L3, R1, R1, L4, L5, R3, L1, L1, R4, L2, R1, R4, R4, L2, L2, R4, L4, R1, R3, L3, L1, L2, R1, R5, L5, L1, L1, R3, R5, L1, R4, L5, R5, R1, L185, R4, L1, R51, R3, L2, R78, R1, L4, R188, R1, L5, R5, R2, R3, L5, R3, R4, L1, R2, R2, L4, L4, L5, R5, R4, L4, R2, L5, R2, L1, L4, R4, L4, R2, L3, L4, R2, L3, R3, R2, L2, L3, R4, R3, R1, L4, L2, L5, R4, R4, L1, R1, L5, L1, R3, R1, L2, R1, R1, R3, L4, L1, L3, R2, R4, R2, L2, R1, L5, R3, L3, R3, L1, R4, L3, L3, R4, L2, L1, L3, R2, R3, L2, L1, R4, L3, L5, L2, L4, R1, L4, L4, R3, R5, L4, L1, L1, R4, L2, R5, R1, R1, R2, R1, R5, L1, L3, L5, R2".split(', ') | |
dist = hor = ver = 0 | |
facing = :north | |
def turn(facing, dir) |
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
#!/usr/bin/env bash | |
# Ask for the administrator password upfront. | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until the script has finished. | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & | |
# Install xcode command line tools | |
xcode-select --install |
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
class CreateSomeModel < ActiveRecord::Migration | |
create_table :some_model do |t| | |
# SomeModel :active should always default to false | |
t.boolean :active, null: false, default: false | |
end | |
end | |
class SomeModel < ActiveRecord::Base | |
# But Model scope will override it | |
default_scope{ where(active: true) } |
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
def authenticate_user_from_token! | |
user_token = request.headers['Auth-Token'].presence || params[:auth_token].presence || nil | |
user = user_token && User.find_by_authentication_token(user_token.to_s) | |
if user | |
@current_user = user | |
end | |
end |
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
[~]$ cat Test.java | |
public class Test { | |
private int i; | |
public int getI() { | |
return i; | |
} | |
public static void main(String[] args) { | |
Test t = new Test(); | |
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
[~]$ javac Test.java | |
Test.java:4: error: variable i might not have been initialized | |
System.out.print(i); | |
^ | |
1 error | |
[~]$ cat Test.java | |
public class Test { | |
public static void main(String[] args) { | |
int i; | |
System.out.print(i); |
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
<head> | |
<!-- Basic Meta Info --> | |
<meta charset="utf-8"> | |
<title> | |
Congratulations! | |
</title> | |
<meta name="description" content="On your engagement!"> | |
<meta name="author" content="Alan, Grace, Jack, Paul, Shaun and Erik"> | |
<!-- Mobile Specific Metas --> |
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
def game_over? | |
count = 0 | |
token = last_token = "" | |
@board.each_index do |col| | |
# Look ahead then track back in each column | |
0.upto(2) do |y| | |
# If the space we are looking at is empty then skip it | |
next if @board[col][y].eql?(EMPTY_SPACE) | |
next unless @board[col][y].eql?(@board[col][y + 3]) |
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
int i = 0; | |
System.out.println("OUTPUT:"); | |
if(true) { | |
i++; | |
System.out.println(i); | |
} | |
/* |
NewerOlder