Skip to content

Instantly share code, notes, and snippets.

View adtennant's full-sized avatar

Alex Tennant adtennant

  • Bristol, United Kingdom
  • 05:44 (UTC +01:00)
View GitHub Profile
import { NestFactory } from '@nestjs/core';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const config = new DocumentBuilder()
.setTitle('Cats example')
.setDescription('The cats API description')
use std::path::PathBuf;
use std::collections::{BTreeMap, HashMap, HashSet};
use std::thread;
use std::os::raw::c_void;
use std::rc::Rc;
use std::cell::{Cell, RefCell};
use std::i16;
use std::time::Instant;
use failure::{err_msg, Error};
<!-- MAKE SURE THIS IS ROW 1 -->
<!-- 1. Google Fonts Code -->
<link href="http://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Space+Mono" rel="stylesheet" type="text/css">
<!-- 2. Dotty Cell Borders -->
<style>
td {
border: 1px dotted black;
}
@adtennant
adtennant / DefaultEntitlement.trigger
Created May 12, 2016 09:00
Replacing your Apex Triggers with Processes and Invocable Actions
trigger DefaultEntitlement on Case (before insert, before update) {
Set<Id> accountIds = new Set<Id>();
for (Case c : Trigger.new){
if (c.EntitlementId == null && c.AccountId != null) {
accountIds.add(c.AccountId);
}
}
if(accountIds.size() > 0) {
onSystemError: function(component, event, handler) {
// You can also use $A.log(), but messages logged using $A.log() do not appear in production environments
console.log(event.getParam("message"));
console.log(event.getParam("error"));
}
public class AdvancedPieService {
public String getFlavour() {
return Pie_Settings__c.getInstance().Flavour__c;
}
}
public class Examples { // Begin class scope
Integer classVariable;
void instanceMethod() { // Begin method scope
Integer methodVariable;
// We can access classVariable because it is defined in a parent scope
classVariable = 0; // OK!
// We can access methodVariable because it's defined in the current scope
public class ShadowingExample {
private Integer shadow;
public ShadowingExample(Integer shadow) {
this.shadow = shadow;
}
public Integer getShadow() {
return shadow;
}
public class Account {
}
HttpRequest req = new HttpRequest();
req.setEndpoint('https://api.example.com/path');
req.setMethod('GET');
String username = 'username';
String password = 'password';
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);