Skip to content

Instantly share code, notes, and snippets.

@tomsseisums
tomsseisums / input.scss
Created March 17, 2021 10:02
Generated by SassMeister.com.
.ContentItem {
&ApplicationForm {
+ * {
margin-top: 80rem;
}
* + &, &:first-of-type {
margin-top: 80rem;
}
@tomsseisums
tomsseisums / ProfileDetailsComponentMap.ts
Created October 19, 2020 16:14
React/TypeScript Component Mapper
import componentMapperFactory from '<path to>/componentMapperFactory'
import PictureDetail from './PictureDetail'
import CopyDetail from './CopyDetail'
import VideoDetail from './VideoDetail'
import SomeOtherDetailType from './SomeOtherDetailType'
export default componentMapperFactory({
picture: PictureDetail,
copy: CopyDetail,
@tomsseisums
tomsseisums / machine.js
Last active January 8, 2020 19:53
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@tomsseisums
tomsseisums / README.md
Last active September 14, 2018 13:12
Nethart GraphQL structure

What we are building here, is a simple homepage composed of pages of blocks.

Not a rich app, really "homepage" that may have various landing pages, has some navigation and bla bla, so... it's built around concept of "Pages", which in our case are defined by "Main" (section:main) section type.

It is somewhat against the Don't model your content for display ideology of Sanity, but in this case it makes sense. We hold data in various documents where they make sense as documents and otherwise structure our pages with "blocks".

In Craft we used the Matrix field type to make the Blocks.
Sanity is much more looser in that sense, we would simply have an array of all the "block" object types.

We'll probably go ham with custom preview components later on. :D

@tomsseisums
tomsseisums / README.md
Last active September 11, 2017 08:56
A rough script to backup/restore shared hosting sites into a tarball. [highly opinionated]

TODO:

  • FUCK BASH!
  • Usage help text
  • Proper validation
  • Removal of set -e and proper error handling
  • Update functionality
  • One client - multiple sites
  • vhost, pool generation
  • Data reuse (database user, ssh client etc.)
@tomsseisums
tomsseisums / Editor\EditorExtensions.cs
Created December 20, 2016 13:20
SceneWasOpened callback for Unity3D Editor
using System.Reflection;
using UnityEditor.SceneManagement;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
public static class EditorExtensions
{
private static FieldInfo sceneWasOpenedCallbackField;
private static FieldInfo SceneWasOpenedCallbackField
using UnityEditor;
using UnityEngine;
[CustomPropertyDrawer(typeof(SceneAssetPathField))]
public class SceneAssetPathFieldPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var oldPath = AssetDatabase.LoadAssetAtPath<SceneAsset>(property.stringValue);
@tomsseisums
tomsseisums / app.js
Created July 2, 2015 11:00
snap.svg, GSAP progress meters for javascript, preset for bar and donut (circle)
var donut = new ProgressMeter.Donut({
fat : 20,
}, {
progress : Math.random() * 100,
keyframes : function(timeline, style)
{
timeline.fromTo(style.meter, 0.5, { colorProps : { fill : 'lime' } }, { colorProps : { fill : 'orange' } }, 0);
timeline.to(style.meter, 0.5, { colorProps : { fill : 'red' } }, 0.5);
},
complete : function()
@tomsseisums
tomsseisums / timeScopes.php
Created April 13, 2015 17:56
Laravel time scopes
class Scopes extends Eloquent
{
public function scopeWeek($query)
{
return $this->scopeTimeFrame($query, 'last week midnight');
}
public function scopeMonth($query)
{
return $this->scopeTimeFrame($query, 'last month midnight');
@tomsseisums
tomsseisums / LogZipResponse.cs
Created March 31, 2015 14:53
Zip as a stream in NancyFX
public class LogZipResponse : Response
{
public LogZipResponse ()
{
this.Contents = GetLogZip();
this.ContentType = "application/x-zip-compressed";
this.StatusCode = HttpStatusCode.OK;
}
private Action<Stream> GetLogZip()