ami-5d38d93c
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
from datetime import datetime | |
from flask import Flask, request | |
app = Flask(__name__) | |
_people = { | |
1: { | |
"id": 1, | |
"name": "user1", | |
"last_signed_at": datetime(2016, 1, 1, 0, 0, 0) |
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 callback(title) { | |
console.log(title); | |
} | |
function getTitle(url, callback) { | |
var title = ''; | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', url, true); | |
var end = false; | |
xhr.onreadystatechange = function() { |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"os/signal" | |
"strconv" | |
"sync" | |
"syscall" | |
) |
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
<?php | |
$user = array( | |
'id' => 1, | |
'last_logged_in_at' => date('Y-m-d H:i:s', strtotime('-20 minute')) | |
); | |
$now = new DateTimeImmutable(); | |
$latLoggedInAt = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $user['last_logged_in_at']); |
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
package main | |
import ( | |
"github.com/gin-gonic/gin" | |
"controllers" | |
) | |
func main() { | |
r := gin.Default() | |
r.POST("/users", controllers.HandleRegisterUser) |
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
if &compatible | |
set nocompatible | |
endif | |
language message C | |
" Key mapping | |
nnoremap <C-h> <C-w>h | |
nnoremap <C-j> <C-w>j | |
nnoremap <C-k> <C-w>k |
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 MasterModel | |
@@records = [ | |
] | |
def initialize(params) | |
@attributes = params | |
end | |
def method_missing(name) | |
if @attributes.key?(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
FROM ruby:2.3 | |
RUN apt-get update && \ | |
apt-get install -y libmysqlclient-dev git gcc g++ make | |
RUN echo "gem: --no-document" > /root/.gemrc | |
RUN mkdir -p /root/app | |
VOLUME /root/app |
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
# | |
# id | name | |
# | |
class User < ActionRecord::Base | |
end | |
# | |
# id | name | |
# | |
class Group < ActionRecord::Base |