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
name: Deploy a dockerised application to Google Cloud Run | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: |
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
server { | |
listen 80; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
try_files $uri $uri/ /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
RequestQueue queue = Volley.newRequestQueue(context); | |
//for POST requests, only the following line should be changed to | |
StringRequest sr = new StringRequest(Request.Method.GET, "http://headers.jsontest.com/", | |
new Response.Listener<String>() { | |
@Override | |
public void onResponse(String response) { | |
Log.e("HttpClient", "success! response: " + response.toString()); | |
} | |
}, |
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
RequestQueue requestQueue; | |
// Instantiate the cache | |
Cache cache = new DiskBasedCache(getCacheDir(), 1024 * 1024); // 1MB cap | |
// Set up the network to use HttpURLConnection as the HTTP client. | |
Network network = new BasicNetwork(new HurlStack()); | |
// Instantiate the RequestQueue with the cache and network. | |
requestQueue = new RequestQueue(cache, network); |
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
""" | |
A linked list is a collection of 'nodes'. | |
The first node is called the head, and it’s used as the starting point for any iteration through the list. | |
The last node must have its next reference pointing to None to determine the end of the list. | |
""" | |
class Node(object): | |
def __init__(self,value): | |
self.value = value | |
self.next = None |
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
// Tag used to cancel the request | |
String tag_json_object = "json_obj_request"; | |
String url = "http://velmm.com/apis/volley_array.json"; | |
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Method.POST, | |
url, null, | |
new Response.Listener<JSONObject>() { | |
@Override | |
public void onResponse(JSONObject response) { |
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
sessionStorage.setItem = function (key, value) { | |
var event = new Event("itemInserted"); | |
event.value = value; // Optional.. | |
event.key = key; // Optional.. | |
document.dispatchEvent(event); | |
originalSetItem.apply(this, arguments); | |
}; | |
var sessionStorageSetHandler = function (e) { | |
console.log(e.key); | |
console.log(e.value); |
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
# Students View | |
class StudentViewSet(viewsets.ModelViewSet): | |
queryset = Student.objects.all() | |
serializer_class = StudentSerializer | |
permission_classes = perms | |
def list(self, request, *args, **kwargs): | |
queryset = Student.objects.all().only("student_id", "first_name", "surname", "gender", "class_ns", "dormitory") | |
serializer = StudentLessDataSerializer(queryset, many=True) | |
return Response(serializer.data) |
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
const { | |
override, | |
fixBabelImports, | |
addWebpackPlugin | |
} = require("customize-cra"); | |
const FilterWarningsPlugin = require("webpack-filter-warnings-plugin"); | |
module.exports = override( | |
fixBabelImports("antd", { | |
libraryDirectory: "es", |
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 python3 | |
import os | |
import subprocess | |
import urllib.request | |
# Required environment variables | |
REQUIRED_ENV_VARS = ( | |
'AZ_GROUP', | |
'AZ_LOCATION', |