Skip to content

Instantly share code, notes, and snippets.

View sulco's full-sized avatar
💭
compiling or woodworking

Tomek Sulkowski sulco

💭
compiling or woodworking
View GitHub Profile
@sulco
sulco / expand-preview-button.js
Created November 8, 2024 13:48
Add expand bolt․new preview button
// Paste into devtools to add the button:
function addButton() {
const targetElement = document.querySelector('[class*="min-h-[var(--panel-header-height)]"]');
console.log('Found target element:', targetElement);
if (targetElement) {
// Create the button
const button = document.createElement('button');
let isWidthSet = false;
@sulco
sulco / copy-prompts.bookmarklet.js
Created November 1, 2024 12:14
Copy Prompts bookmarklet
javascript:(function(){
const result = [...document.querySelectorAll('.text-bolt-elements-textSecondary + div > div > ._MarkdownContent_1mdbx_1')]
.map(node => node.innerText)
.reduce((acc, curr) => acc + curr + '\n\n', '');
navigator.clipboard.writeText(result)
.then(() => alert('Content copied to clipboard!'))
.catch(err => alert('Failed to copy: ' + err));
})();
@sulco
sulco / stackblitz-bolt-blue.svg
Created August 16, 2024 12:42
StackBlitz logo (svg)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sulco
sulco / sluggify.js
Last active August 9, 2024 08:43
Sluggify — add `slug` to each part, chapter and lesson of a TutorialKit project
/*
Notes:
- This might change A LOT — remember to commit your current TutorialKit state before using this script.
- To run it, put the file in your `src/content/tutorial` folder and from there run `node sluggify.js`
*/
import { promises as fs } from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
@sulco
sulco / hidden-actions.css
Created December 13, 2023 14:54
hide vscode action icons – only show them on hover
.title-actions,
.global-actions,
.editor-actions {
opacity: 0 !important;
transition: opacity 0.2s;
}
.title-actions:hover,
.editor-actions:hover {
opacity: 1 !important;
@sulco
sulco / example.js
Created February 1, 2022 20:47
StackBlitz Guide: Example of `files` payload
{
files: {
src: {
name: 'src',
type: 'folder',
contents: '',
fullPath: 'src',
lastModified: 1525387210297
},
'src/app': {
@sulco
sulco / clown-formatter.js
Created December 10, 2018 19:11
A clown formatter
window.devtoolsFormatters = [{
header: function(obj){
if (!obj.__clown) {
return null;
}
delete obj.__clown;
const style = `
color: red;
border: dotted 2px gray;
border-radius: 4px;
@sulco
sulco / theme.directive.ts
Created November 4, 2018 16:12
Angular theme directive
import { Directive, ElementRef, Input, OnChanges } from '@angular/core';
/**
* Usage:
* <mycomponent [dtTheme]="{'color-main': '#bada55'}"></mycomponent>
*/
@Directive({
selector: '[dtTheme]'
})
export class ThemeDirective implements OnChanges {
@sulco
sulco / index.ts
Created April 30, 2018 21:04
Bootstrapping Angular module, with custom-elements shim
import 'zone.js/dist/zone';
import '@webcomponents/custom-elements/src/native-shim';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { ButtonModule } from './button.module';
platformBrowserDynamic().bootstrapModule(ButtonModule);