Skip to content

Instantly share code, notes, and snippets.

View Londeren's full-sized avatar
💭
Building a rocket 🚀

Sergey Lebedev Londeren

💭
Building a rocket 🚀
View GitHub Profile
@ericjeker
ericjeker / content-child.component.ts
Created March 13, 2020 06:42
TemplateRef and ngTemplateOutlet using ContentChild in Angular
@Component({
selector: 'app-my-content',
template: '<ng-container *ngTemplateOutlet="tplRef"></ng-container>',
})
class MyContent {
@ContentChild('myContent', {static: true}) tplRef: TemplateRef<any>;
}
@cho0o0
cho0o0 / generateAccesskey.js
Last active March 11, 2024 13:14
Generate Outline access key based on Shadowsocks infomation
const generateAccesskey = (method, password, ip, port) => {
const firstPart = btoa(`${method.toLowerCase()}:${password}`)
const secondPart = `${ip}:${port}`
const accesskey = `ss://${firstPart}@${secondPart}`
return accesskey
}
@T-Rave
T-Rave / alfred-clipboard-dump.sh
Last active June 1, 2023 20:53
Alfred, Mac OS X app, full clipboard dump to text file
## Must have sqlite3 installed. Homebrew user? brew install sqlite
## Can be ran directly in command line and will place file directory where ran
## Remove `-header` if you don't want the output to have the column name `item`
## Checkout more options and Workflow - https://github.com/T-Rave/alfred-clipboard-dump
# dumps output with list option since single column. Produces cleaner data without double quotes
sqlite3 -header -list ~/Library/Application\ Support/Alfred\ 3/Databases/clipboard.alfdb "SELECT item FROM clipboard;" > clipboard-dump.txt
# dumps full table to csv format
sqlite3 -header -csv ~/Library/Application\ Support/Alfred\ 3/Databases/clipboard.alfdb "SELECT * FROM clipboard;" > clipboard-dump.csv
# dumps only items in descending (inverse) order with no column name
sqlite3 -list ~/Library/Application\ Support/Alfred\ 3/Databases/clipboard.alfdb "SELECT item FROM clipboard ORDER BY item DESC;" > clipdump.txt
dialog {
position: fixed;
top: 50%;
left: 50%;
right: auto;
padding: 30px;
transform: perspective(500px) translate(-50%, -50%);
background: linear-gradient(to bottom, #FFF, #F4F4F4) #FFF;
border: none;
border-radius: 3px;
@LeaVerou
LeaVerou / log-traps.js
Last active January 28, 2018 12:22
Log all proxy traps
function createLoggedProxy(obj) {
var traps = {};
for (let trap of Object.getOwnPropertyNames(Reflect)) {
traps[trap] = (...args) => {
console.log(trap, ...args.slice(0, -1)); // Last arg is always the proxy, no need to log it
return Reflect[trap](...args);
}
}
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 6, 2024 07:52
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@jacurtis
jacurtis / _spacing-helpers.scss
Last active April 15, 2024 12:05
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
@developit
developit / _preact-pure-component.md
Created September 7, 2016 14:14
pure-component for Preact

pure() can be used as a higher order function or a decorator.

When passed a pure functional component, it wraps the function in a classful Component with a shouldComponentUpdate() that ignores renders for unchanged props.

When passed a classful Component, it injects a shouldComponentUpdate() method into the Component's prototype that ignores renders for unchanged props & state.

Functional Example

import pure from 'pure-component';
@maxtruxa
maxtruxa / Antonyms.md
Last active May 6, 2024 09:31
A list of common terms used in programming and their respective antonyms.

Antonym List

Note: The table headings (positive/negative) are not necessarily meaningful.

Positive Negative
acquire release
add remove (e.g. an item), subtract (arithmetic)
advance retreat
allocate deallocate (correct), free (common)
allow deny
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active May 6, 2024 12:29
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest