Skip to content

Instantly share code, notes, and snippets.

struct ContentView: View {
var body: some View {
VStack {
HStack {
Spacer()
Button { } label: {
Image(systemName: "power")
.resizable()
.aspectRatio(contentMode: .fill)
.padding()
@jackismissing
jackismissing / MatcapDisplacement.js
Last active April 28, 2024 17:55
Threejs MeshMatcapMaterial normals displacement
const matcapTexture = new THREE.TextureLoader().load(matcap);
const material = new THREE.MeshMatcapMaterial({
color: 0xFFFFFF,
matcap: matcapTexture
});
const uniforms = {
uTime: { value: 0 }
};
@maxfierke
maxfierke / cancelable-fetch.js
Last active April 21, 2022 18:15
cancelableFetch Yieldable ember-concurrency
import { Yieldable } from 'ember-concurrency';
import fetch from 'fetch'; // i.e. ember-fetch. could also use native fetch too.
class FetchYieldable extends Yieldable {
constructor(url, opts = {}) {
super(...arguments);
this.url = url;
this.opts = opts;
}
@marcedwards
marcedwards / circlesofdots.pde
Created June 28, 2019 10:43
Circles of dots in Processing
//
// Circles of dots.
// Created using Processing 3.5.3.
//
// Code by @marcedwards from @bjango.
//
// A GIF of this code can be seen here:
// https://twitter.com/marcedwards/status/1144236924095234053
//
// app/adapters/application.js
import DS from 'ember-data';
import { inject as service } from '@ember-decorators/service';
const { RESTAdapter } = DS;
export default class ApplicationAdapter extends RESTAdapter {
@service fastboot;
@service shoebox;
@mattdesl
mattdesl / about.md
Last active September 29, 2023 20:08
interactive audio sketch
@khalilgharbaoui
khalilgharbaoui / db.rake
Created February 3, 2019 21:29 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# Original source: https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90
# Merged with: https://gist.github.com/kofronpi/37130f5ed670465b1fe2d170f754f8c6
# Benefits of: https://gist.github.com/e12e/e0c7d2cc1d30d18c8050b309a43450ac
# And fixes of: https://gist.github.com/joelvh/f50b8462611573cf9015e17d491a8a92
namespace :db do
desc 'Dumps the database to backups'
task dump: :environment do
dump_fmt = ensure_format(ENV['format'])
dump_sfx = suffix_for_format(dump_fmt)
backup_dir = backup_directory(Rails.env, create: true)
@machty
machty / some-route.js
Last active June 17, 2018 14:02
I have a user-activity service that exposes some observables that monitor the user clicking/tapping around and expose some convenience methods for generating new observables, which allows for the flexibility of consumers specifying different activity times. Refactoring this to use tasks vs observables points out a few awkward cases that could be…
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
const DEFAULT_INACTIVITY_TIMEOUT_MS = 10 * 60 * 1000
export default Route.extend({
session: service(),
userActivity: service(),
notifications: service(),
logoutTimeoutSubscription: null,
activate() {
@nightire
nightire / debug_ember_app_in_vscode.md
Created May 17, 2018 11:21
How to debug an ember application with VS Code

Step 1: Launch Google Chrome with Remote Debugging support

  • windows: <path to chrome>/chrome.exe --remote-debugging-port=9222
  • macOS: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
  • linux: google-chrome --remote-debugging-port=9222

Step 2: Install "Debugger for Chrome" extension

Step 3: Setup your application

@anulman
anulman / README.md
Last active April 26, 2018 08:54
Ember.js publishing tools

Ember publishing tools

This document is intended as a "scratchpad" to think through Ember-based systems.

CMS Design Requirements

  • MUST have a content store
    • Content MAY be stored with source
    • Content models MAY be related to other, differently-formed content models
  • MUST support POJO content metadata