Skip to content

Instantly share code, notes, and snippets.

View hypeJunction's full-sized avatar

Ismayil Khayredinov hypeJunction

View GitHub Profile
(function($) {
$.fn.oembed = function(url, options, callback) {
options = $.extend(true, $.fn.oembed.defaults, options);
return this.each(function() {
var container = $(this),
resourceURL = (url != null) ? url : container.attr("href"),
provider;
@loonies
loonies / 1_phpunit-api.md
Last active January 19, 2024 07:34
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this->anything()
@mrkmg
mrkmg / genColorCodeFromText.php
Created January 13, 2012 17:22
Generate a unique color based on text input
<?php
/*
* Outputs a color (#000000) based Text input
*
* @param $text String of text
* @param $min_brightness Integer between 0 and 100
* @param $spec Integer between 2-10, determines how unique each color will be
*/
function genColorCodeFromText($text,$min_brightness=100,$spec=10)
@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@zachleat
zachleat / gist:2008932
Created March 9, 2012 21:56
Prevent zoom on focus
// * iOS zooms on form element focus. This script prevents that behavior.
// * <meta name="viewport" content="width=device-width,initial-scale=1">
// If you dynamically add a maximum-scale where no default exists,
// the value persists on the page even after removed from viewport.content.
// So if no maximum-scale is set, adds maximum-scale=10 on blur.
// If maximum-scale is set, reuses that original value.
// * <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=2.0,maximum-scale=1.0">
// second maximum-scale declaration will take precedence.
// * Will respect original maximum-scale, if set.
// * Works with int or float scale values.
@mrclay
mrclay / Elgg-MenuList.php
Last active February 23, 2016 19:04
Manage arrays of Elgg menu items
<?php
namespace UFCOE\Elgg;
/**
* Manage lists of Elgg menu items (during prepare hook) without losing sanity
*/
class MenuList
{
protected $items = array();
<?php
/**
* This has been moved to a GitHub project:
*
* @link https://github.com/mrclay/elgg-url-sniffer
*/
@andybeak
andybeak / xssTest.php
Last active April 23, 2020 16:17
PHPunit test for a permissive xss routine
<?php
/**
*
* There are use cases where using filter_var( FILTER_SANITIZE_STRING ) is not desireable because it is too greedy.
* In the event that you have written a more permissive xss cleaning routine this unit test can be used to test your
* cleaning routine. The list of attack vectors is not comprehensive but should give you a good start.
*
* The detection routine below is based on https://github.com/symphonycms/xssfilter/blob/master/extension.driver.php
* and on https://gist.github.com/mbijon/1098477
@stefanmaric
stefanmaric / open-sans.css
Created June 16, 2015 17:48
All (13) Open Sans variants. CSS embedded. WOFF format. Base64 encoded. Basic Western subsetting. font-face declaration using style links.
/* Open Sans - by Steve Matteson, Apache License version 2.0 */
/* Open Sans Light */
@font-face {
font-family: 'Open Sans';
src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAF5IABMAAAAArgwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABqAAAABwAAAAca7DAFEdERUYAAAHEAAAAHQAAAB4AJwDwR1BPUwAAAeQAAASiAAAJmCwaFlhHU1VCAAAGiAAAAIEAAACooF6Ikk9TLzIAAAcMAAAAXgAAAGCgeJYXY21hcAAAB2wAAAGGAAAB2s9AWKBjdnQgAAAI9AAAADgAAAA4ClINZmZwZ20AAAksAAABsQAAAmVTtC+nZ2FzcAAACuAAAAAIAAAACAAAABBnbHlmAAAK6AAASiYAAI54OERAeGhlYWQAAFUQAAAAMwAAADYJcp/SaGhlYQAAVUQAAAAfAAAAJA9bBixobXR4AABVZAAAAjEAAAOmuKtcmWxvY2EAAFeYAAABzgAAAdZKMihUbWF4cAAAWWgAAAAgAAAAIAIHAc1uYW1lAABZiAAAAhoAAATiYqqsfHBvc3QAAFukAAAB6wAAAt17wozucHJlcAAAXZAAAACvAAABLyQjUqh3ZWJmAABeQAAAAAYAAAAG7WNVfgAAAAEAAAAA0MoNVwAAAADJQhTbAAAAANGkneF42mNgZGBg4AFiMSBmYmAEwpdAzALmMQAADaEBGAAAAHjarZZLbFRVGMf/M51hxoKWqtH4CBoyNrUGjQ1J27GwatpaDZZpi4MOig/iAkJCY0hMExaFgbgwIQYrOTxqCkyh0FmQUpryMkxXLNzhaW3jyuVJV8QFIY6/c9sp4EjVxHz55dw597vf43/OPXMVklSpbn2qSEvru916/rOvenep5oveHTtVv+uTL3dro
@wandersonwhcr
wandersonwhcr / phpunit.php
Created August 18, 2016 21:29
Programmatically PHPUnit
<?php
chdir(__DIR__);
require 'vendor/autoload.php';
$suiteA = new PHPUnit_Framework_TestSuite();
$suiteA->addTestFiles([
'./module/PackageA/test/DumbTest.php',