Skip to content

Instantly share code, notes, and snippets.

View boris317's full-sized avatar

Shawn Adams boris317

View GitHub Profile
Shawn's Intellij Shortcuts
Symbols:
⌥ Option
⌘ Command
⇧ Shift
⌃ Control
← Left arrow
→ Right Arrow
↑ Up Arrow
let plugins = getPlugins()
.flatMap(p => p)
// Group plugins by consumer_id or app_id
.reduce((obj, p) => {
let id = p.consumer_id || p.api_id;
if (id in obj) {
obj[id].push(p);
} else {
obj[id] = [p];
}
@boris317
boris317 / foo.js
Created September 12, 2018 13:48
POST with ajax
$("#newDeviceForm").submit(function(e) {
// Don't let the browser submit automatically
e.preventDefault();
$.ajax({
type: "POST",
url: "http://rad8prod-env.paxsdtgzng.us-east-1.elasticbeanstalk.com/devices",
headers: {
Authorization: "dev_env_pw"
},
data: this.serialize(),
class AirBookingService {
private final Database db;
private final BookingService bookings;
private static final Map<String, User> userCache = new HashMap<>();
public AirBookingService() {
db = new Database();
bookings = BookingServiceFactory.getService();
}
export function renderComponent(component, query, variables) {
let {loading, error, data} = useQuery(query, {variables});
if (loading) {
return null;
}
if (error) {
console.log(error);
}