A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.
posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord
public class MyBehavior : MonoBehaviour { | |
// This will store the string value | |
[StringInList("Cat", "Dog")] public string Animal; | |
// This will store the index of the array value | |
[StringInList("John", "Jack", "Jim")] public int PersonID; | |
// Showing a list of loaded scenes | |
[StringInList(typeof(PropertyDrawersHelper), "AllSceneNames")] public string SceneName; | |
} |
// Based on http://www.tallior.com/find-missing-references-unity/ | |
// It fixes deprecations and checks for missing references every time a new scene is loaded | |
// Moreover, it inspects missing references in animators and animation frames | |
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.SceneManagement; | |
using System.Linq; | |
[InitializeOnLoad] |
using System; | |
using UnityEngine; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
public class DraggablePoint : PropertyAttribute {} | |
#if UNITY_EDITOR |
// Copyright (c) 2022 Piero Dotti, Elf Games | |
// | |
// Permission is hereby granted, free of charge, to any person | |
// obtaining a copy of this software and associated documentation | |
// files (the "Software"), to deal in the Software without | |
// restriction, including without limitation the rights to use, | |
// copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the | |
// Software is furnished to do so, subject to the following | |
// conditions: |
# rubocop disable:all | |
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' |
recipe :pasta do | |
add 1.liter, of: :water, in: :pot | |
turn_on :fire | |
wait_until :pot, :boiling? | |
add 1.gram, of: :salt, in: :pot | |
wait 1.minute | |
add 150.grams, of: :pasta, in: :pot |
import { Parser } from './parser'; | |
import 'models'; | |
const parsable = `{ | |
"data": [ | |
{ | |
"id": "2", "type": "posts", | |
"attributes": { "name": "My post", "ciao": null, "description": "ciao", "created_at": "2020-10-10T10:32:00Z" }, | |
"relationships": { "user": { "data": { "id": "3", "type": "users" } } } | |
} |
#!/bin/bash | |
GREEN='\033[0;32m' | |
RED='\033[0;31m' | |
YELLOW='\033[0;33m' | |
NC='\033[0m' | |
rm unused_files.log &> /dev/null | |
grep -r . --include=\*.meta --exclude=*{Editor,Gizmos}* -e 'guid' | while read line; do |
import * as memoizee from 'memoizee'; | |
var objIdMap = new WeakMap, objectCount = 0; | |
function objectId(object: any){ | |
if (!objIdMap.has(object)) { objIdMap.set(object,++objectCount); } | |
return objIdMap.get(object); | |
} |