Skip to content

Instantly share code, notes, and snippets.

View thetw's full-sized avatar
👨‍💻

Thorge Wandrei thetw

👨‍💻
View GitHub Profile
@ben-rogerson
ben-rogerson / twin.code-snippets
Last active June 16, 2023 02:22
Twin Code Snippits for use in vscode - Shortcuts that make working with Twin a little easier
{
// Snippits that make working with Twin a little easier
// https://github.com/ben-rogerson/twin.macro
"Add react import": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "react",
"body": "import React from 'react'",
"description": "Add react import"
},
"Add twin imports": {
@jamessimone
jamessimone / CollectionUtils.cls
Last active April 8, 2024 09:27
Helper methods for working with collections in Apex
public class CollectionUtils {
public static List<Id> convertToIdList(List<SObject> sObjectList) {
return new List<Id>(convertToIdSet(sObjectList));
}
public static List<Id> convertToIdList(List<SObject> sObjectList, SObjectField field) {
return convertToIdList(sObjectList, string.valueOf(field));
}
public static List<Id> convertToIdList(List<SObject> sObjectList, string field) {
@bakura10
bakura10 / microdata-schema.liquid
Last active July 21, 2025 07:34
This is the last microdata-schema for our Shopify themes
{%- comment -%}
This snippet structures the micro-data using JSON-LD specification. Please note that for Product especially,
the schema often changes. We try to output as much info as possible, but Google may add new requirements over time,
or change the format of some info
LAST UPDATE: May 10th 2023 (we added the "hasMerchantReturnPolicy" and "shippingDetails" to include the shipping and
return policy if they have been specified as store policies).
{%- endcomment -%}
{%- if request.page_type == 'product' -%}
@palmerc
palmerc / userpic.sh
Last active May 26, 2024 10:44 — forked from acidprime/userpic.sh
Updating a user's picture from a script
#!/bin/bash
set -e
declare -x USERNAME="$1"
declare -x USERPIC="$2"
declare -r DSIMPORT_CMD="/usr/bin/dsimport"
declare -r ID_CMD="/usr/bin/id"
@booleangate
booleangate / a-salesforce-oauth-2.0-jwt-bearer-token-flow-walk-through.md
Last active May 8, 2025 00:39
Salesforce OAuth 2.0 JWT Bearer Token Flow walk-through

Salesforce OAuth 2.0 JWT Bearer Token Flow Walk-Through

This document will walk you through how to create or configure a Salesforce application for use with JWT authentication. These configuration steps and the example code works as of Salesforce API version 42.0.

Prerequisites

Create an RSA x509 private key/certification pair

@raphaelhanneken
raphaelhanneken / NSImageExtensions.swift
Last active July 20, 2025 07:15
NSImage extensions for easy resizing, cropping and saving png images.
//
// NSImageExtensions.swift
//
import Cocoa
extension NSImage {
/// The height of the image.
var height: CGFloat {
@cdeckert
cdeckert / RestDispatcher.cls
Created August 26, 2014 17:24
Rest Dispatcher
/**
* @description URL dispatcher
*/
@RestResource(urlMapping = '/*')
global class RestDispatcher
{
// dispatchables
static Map<RequestType, List<Dispatchable>> dispatchables;
// requestTypes
enum RequestType {HTTPGET, HTTPPOST, HTTPPUT, HTTPDELETE, HTTPPATCH}
@nicocrm
nicocrm / gist:858086
Created March 7, 2011 04:50
SalesForce Apex CSV Parser
/**
* Used to read a delimited file.
*/
public class SSSCsvReader {
private String delim = ',';
// the input data
private String[] buffer;
public SSSCsvReader(String data){
this.buffer = data.split('\n');