Skip to content

Instantly share code, notes, and snippets.

View fostyfost's full-sized avatar
🤪
All you need is Half-Life 3

Fosty Fost fostyfost

🤪
All you need is Half-Life 3
View GitHub Profile
@darekkay
darekkay / intellij-monokai-theme.xml
Last active March 5, 2021 09:47
Monokai Theme for JetBrains IDEs (IntelliJ IDEA, Webstorm, PhpStorm, PyCharm etc.)
<scheme name="Eclectide Monokai" version="142" parent_scheme="Default">
<colors>
<option name="ADDED_LINES_COLOR" value="295622" />
<option name="ANNOTATIONS_COLOR" value="b2c0c6" />
<option name="CARET_COLOR" value="bbbbbb" />
<option name="CARET_ROW_COLOR" value="" />
<option name="CONSOLE_BACKGROUND_KEY" value="1c1c1c" />
<option name="FILESTATUS_ADDED" value="629755" />
<option name="FILESTATUS_DELETED" value="6c6c6c" />
<option name="FILESTATUS_IDEA_FILESTATUS_DELETED_FROM_FILE_SYSTEM" value="6c6c6c" />
@didi0613
didi0613 / shorten-css-classname.md
Last active March 22, 2021 08:46
Shorten css class names for css module

Shorten css class names for css module

Jira Ticket

https://jira.walmart.com/browse/CEECORE-255

Background

Electrode Application can use css-modules as one of the style options, CSS names can get long with local identifier name and random hash.

@herr-vogel
herr-vogel / material-ui-next-js-button.js
Last active November 16, 2021 10:14
Using Material-UI Button with Next.js Link
import React from 'react'
import Link from 'next/link'
import Button from '@material-ui/core/Button'
const ButtonLink = ({ className, href, hrefAs, children, prefetch }) => (
<Link href={href} as={hrefAs} prefetch>
<a className={className}>
{children}
</a>
</Link>
@halfempty
halfempty / instafeed.js
Created June 7, 2014 00:52
Instafeed example for @jerb0x
var feed = new Instafeed({
get: 'user',
userId: 636337139,
accessToken: '262351.467ede5.176ab1984b1d47e6b8dea518109d7a5e',
link: 'true',
clientId: '80aeda87e8c44281b83ce6f542a30933',
limit: '1',
sortBy: 'most-recent',
resolution: 'standard_resolution',
links: false,
@may-cat
may-cat / 1 Пример с репозиториями организаций на гитхабе
Last active August 10, 2022 06:30
Примеры composer.json под Битрикс. Показывают, как подключать модули с помощью композера.
{
"name": "yourcompany/myproject",
"description": "Какой-то проект нашей компании",
"keywords": ["bitrix", "проектище"],
"homepage": "http://bitrix.expert/",
"type": "project",
"license": "Commerce",
"support": {
"source": "http://github.com/bitrix-expert/"
},
@lokhmakov
lokhmakov / index.js
Last active October 25, 2022 08:37
effector - run effect once through event
const runQuery = createEffect({
handler(props) {
console.log(props)
},
})
const createOnceEvent = to => {
const from = createEvent()
const unsubscribe = forward({from, to})
from.watch(unsubscribe)
@phobeo
phobeo / javascript aspect ratio calculation (with GCD)
Created January 24, 2011 15:02
javascript aspect ratio calculation algorithm (take the GCD and divide both elements of resolution)
/* euclidean GCD (feel free to use any other) */
function gcd(a,b) {if(b>a) {temp = a; a = b; b = temp} while(b!=0) {m=a%b; a=b; b=m;} return a;}
/* ratio is to get the gcd and divide each component by the gcd, then return a string with the typical colon-separated value */
function ratio(x,y) {c=gcd(x,y); return ""+(x/c)+":"+(y/c)}
/* eg:
> ratio(320,240)
"4:3"
> ratio(360,240)
@tomysmile
tomysmile / mac-php-composer-setup.md
Created July 11, 2016 10:45
Setup PHP Composer using Brew
@matthewmueller
matthewmueller / escape-json.js
Created August 25, 2012 02:50
Escape JSON strings before trying to run JSON.parse
/*
Escape JSON
*/
var escapeJSON = exports.escapeJSON = function(json) {
var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
var meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
@getify
getify / 1-setup.js
Last active December 15, 2023 13:25
find size of largest region in matrix... solutions are breadth-first iterative (2) and depth-first recursive (3)
// Adapted from: https://www.geeksforgeeks.org/find-length-largest-region-boolean-matrix/
"use strict";
var M1 = [
[ 0, 0, 1, 1, 0 ],
[ 1, 0, 1, 1, 0 ],
[ 0, 1, 0, 0, 0 ],
[ 0, 0, 0, 1, 1 ]
];