Разделы
Теги | RSS © 2008 – 2017
Контакты
email: igor@veselov.sumy.ua
skype: utz0r2
» » Страница 9

RedBeanPHP - php ORM для работы с базами данных


Поддерживает через pdo драйвер такие бд: MySQL, MariaDB, SQLite, PostgreSQL and CUBRID
    require 'rb.php';
    R::setup();
    R::setAutoResolve( TRUE );        //Recommended as of version 4.2
    $post = R::dispense( 'post' );
    $post->text = 'Hello World';

    $id = R::store( $post );          //Create or Update
    $post = R::load( 'post', $id );   //Retrieve
    R::trash( $post );                //Delete

http://redbeanphp.com/

CImage - php скрипт для манипуляций над изображениями


CImage - php скрипт для манипуляций над изображениями

img.php?src=kodim04.png&width=80&height=80&crop-to-fit

https://cimage.se/

lonekorean/highlight-within-textarea - js скрипт подсветки кусков кода в textarea


$('.my-textarea').highlightWithinTextarea({
    highlight: whatever // string, regexp, array, function, or custom object
});

https://github.com/lonekorean/highlight-within-textarea | Демка

spected - js скрипт валидации


Пример
import {
  compose,
  curry,
  head,
  isEmpty,
  length,
  not,
  prop,
} from 'ramda'

import spected from 'spected'

// predicates

const notEmpty = compose(not, isEmpty)
const hasCapitalLetter = a => /[A-Z]/.test(a)
const isGreaterThan = curry((len, a) => (a > len))
const isLengthGreaterThan = len => compose(isGreaterThan(len), prop('length'))


// error messages

const notEmptyMsg = field => `${field} should not be empty.`
const minimumMsg = (field, len) => `Minimum ${field} length of ${len} is required.`
const capitalLetterMag = field => `${field} should contain at least one uppercase letter.`

// rules

const nameValidationRule = [[notEmpty, notEmptyMsg('Name')]]

const randomValidationRule = [
  [isLengthGreaterThan(2), minimumMsg('Random', 3)],
  [hasCapitalLetter, capitalLetterMag('Random')],
]

const validationRules = {
  name: nameValidationRule,
  random: randomValidationRule,
}

spected(validationRules, {name: 'foo', random: 'Abcd'})
// {name: true, random: true}

https://github.com/25th-floor/spected

js-joda - скрипт для работы с неизменной датой


Пример
// obtain the current date in the system default timezone, e.g. 2016-02-23
LocalDate.now();

// obtain the current date in the utc timezone, e.g. 2016-02-23
LocalDate.now(ZoneOffset.UTC);

// obtain an instance of LocalDate from an ISO8601 formatted text string
LocalDate.parse('2016-02-23');

// obtain an instance of LocalDate from a year, month, and dayOfMonth value
LocalDate.of(2016, 2, 23) // 2016-02-23

// obtain an instance of LocalDate from a year, month, and dayOfMonth value
LocalDate.of(2016, Month.FEBRUARY, 23) // 2016-02-23

// obtain an instance of LocalDate from am epochDay where day 0 is 1970-01-01
LocalDate.ofEpochDay(-1) // 1969-12-31

// obtain an instance of LocalDate from am epochDay where day 0 is 1970-01-01
LocalDate.ofYearDay(2016, 42) // 2016-02-11

https://js-joda.github.io/js-joda/

Timeline.js - скрипт создания временной линии


Timeline.js - скрипт создания временной линии

https://ilkeryilmaz.github.io/timelinejs/
«»
Вверх