Skip to content

Instantly share code, notes, and snippets.

View Realetive's full-sized avatar

Realetive Realetive

View GitHub Profile
<?php
/**
* CercecUser
*
* @author Marc Elie <[email protected]>
*
* Event: OnUserFormSave
*
* Modified from Bob Ray's plugin tutorial, Official Guide p. 492-3
* and Bob Ray's online explanation on create class:
<?php
/*
Output filter to retrieve names of TVs from a list of TV ids
[email protected]
Idea:
Use it with toogleTVSet plugin (included below) to handel different template options.
Usage:
@Realetive
Realetive / affix.html
Last active August 29, 2015 14:17 — forked from Cezarion/affix.html
<script type="text/javascript">
window.onscroll = scroll;
function scroll () {
var scrollTop = window.pageYOffset;
console.log(scrollTop);
if( scrollTop > 363 ){
document.getElementById('summary').style.top="20px";
document.getElementById('summary').style.position="fixed";
}
else

Twin Components

Я также спросил это на GitHub. Предположим, есть компоненты Signin и Signup. Они близнецы:

Signup:

<main>
  <h1 className={styles.h1}>Sign Up</h1>
@Realetive
Realetive / README.md
Created October 5, 2016 13:01 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@Realetive
Realetive / gulpfile.js
Created November 24, 2016 14:49 — forked from belozer/gulpfile.js
Gulpfile with gulp-bem-presets
const gulp = require('gulp');
const Builder = require('gulp-bem-bundle-builder');
const bundler = require('gulp-bem-bundler-fs');
const nodemon = require('gulp-nodemon');
const merge = require('merge2');
const debug = require('gulp-debug');
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
const gulpif = require('gulp-if');
const concat = require('gulp-concat');
@Realetive
Realetive / gist:da954c146be8e4da51b4a93c0c8e8be0
Created January 20, 2017 20:09 — forked from realmyst/gist:1262561
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
@Realetive
Realetive / post-merge
Created June 21, 2017 14:38 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@Realetive
Realetive / remove-gpg-user.sh
Created February 25, 2019 12:36
Git-crypt remove user.
#!/usr/bin/env bash
#
# Script to remove GPG key from git-crypt
#
# It will re-initialize git-crypt for the repository and re-add all keys except
# the one requested for removal.
#
# Note: You still need to change all your secrets to fully protect yourself.
# Removing a user will prevent them from reading future changes but they will
# still have a copy of the data up to the point of their removal.
@Realetive
Realetive / widget.md
Created April 5, 2021 05:10 — forked from AlexxNB/widget.md
Howto make no-depends widget on Svelte and load it on the page

We should have at least three files: 'Widget.svelte', 'rollup.config.js' and 'package.json':

  1. Our widget Widget.svelte:
<script>
	export let name;
</script>

<h1>Hello {name}!</h1>