Skip to content

Instantly share code, notes, and snippets.

@ericallam
ericallam / AssemblyCompilationReporter.cs
Created April 10, 2018 10:43
Unity - Log Assembly Compilation times
namespace Editor {
public class AssemblyCompilationReporter {
[InitializeOnLoadMethod]
private static void Init() {
CompilationPipeline.assemblyCompilationStarted += CompilationPipelineOnAssemblyCompilationStarted;
CompilationPipeline.assemblyCompilationFinished += CompilationPipelineOnAssemblyCompilationFinished;
}
private static void CompilationPipelineOnAssemblyCompilationFinished(string s, CompilerMessage[] compilerMessages) {
class ZombiesController < ApplicationController
before_filter :find_zombie
before_filter :check_for_tweets
def show
render :action => :show
end
def find_zombie
@zombie = Zombie.find params[:id]
import { client } from "@/trigger"
import { eventTrigger, isTriggerError } from "@trigger.dev/sdk"
import { OpenAI } from "@trigger.dev/openai"
import { Supabase } from "@trigger.dev/supabase"
import { z } from "zod"
import _ from "lodash"
import { write } from "@/lib/neo4j"
@ericallam
ericallam / app.coffee
Created November 8, 2011 20:02
Set certain regions of an Ace editor to readOnly
event = require('pilot/event')
Anchor = require('ace/anchor').Anchor
doc = ace_editor.session.getDocument()
editablePositions = [[1, 0, 2, 0]] # allow editong only the second row
jQuery.each editable, (index, row) ->
editablePositions.push [new Anchor(doc, row[0], row[1]), new Anchor(doc, row[2], row[3])]
Range = require('ace/range').Range
@ericallam
ericallam / DOC.md
Created September 2, 2020 10:26
TextureFromFile leak post-mortem

TextureFromFile leak post-mortem

Usages of TextureFromFile in the game to load an image from StreamingAssets could lead to a memory leak of the loaded texture in the case of the TextureFromFile instance being cancelled before it finished.

This would happen in the case of the saga map collection view object reuse (e.g. SagaMapPlayStoryPolaroid) where a view object would be loaded and an initial TextureFromFile instance would get created, and then in the same frame that view object would be recycled and reused for a different section of the map, causing that original TextureFromFile instance to be cancelled.

The TextureFromFile.Cancel method looked like this:

public void Cancel()
FROM sitespeedio/node:ubuntu-22.04-nodejs-18.12.1 AS pruner
RUN apt-get update && apt-get install -y openssl
WORKDIR /app
RUN npm install turbo -g
COPY . .
RUN turbo prune --scope=webapp --docker
RUN find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
# Base strategy to have layer caching
FROM sitespeedio/node:ubuntu-22.04-nodejs-18.12.1 AS base
{
"method": "POST",
"uri": "https://api.airtable.com/...",
"headers": {
"content-type": "application/json"
}
}
type TabProps = {
defaultActiveKey: string;
className?: string;
children: ReactNode;
};
type TabContentProps = {
eventKey: string;
children: ReactNode;
title: string;
@ericallam
ericallam / gist:1019446
Created June 10, 2011 18:35
How to log all queries for a PostgreSQL homebrew install on OS X

Open the postgresql.conf config file:

$> mate /usr/local/var/postgres/postgresql.conf

Uncomment the line with 'log_destination' and set it to 'syslog'

log_destination = 'syslog'

Open the syslog config:

@ericallam
ericallam / CLLocationManager+MockingLocation.h
Created June 1, 2013 03:57
Mocking out CLLocationManager
#import <CoreLocation/CoreLocation.h>
extern CLLocationDegrees kMockedLatitude;
extern CLLocationDegrees kMockedLongitude;
@interface CLLocationManager (MockingLocation)
+ (BOOL)custom_locationServicesEnabled;
+ (CLAuthorizationStatus)custom_authorizationStatus;
-(void)custom_startUpdatingLocation;