Skip to content

Instantly share code, notes, and snippets.

View Awilum's full-sized avatar
🧙‍♂️
WORK HARD. PLAY HARD

Sergey Romanenko Awilum

🧙‍♂️
WORK HARD. PLAY HARD
View GitHub Profile
@Awilum
Awilum / example.php
Created February 16, 2012 15:02
Tweevalid - php validator in less that 140 bytes
$valid = new Tweevalid();
var_dump($valid->email('test@test.com'));
var_dump($valid->url('http://test.com'));
var_dump($valid->ip('10.10.10.10'));
@Awilum
Awilum / atweet.php
Last active February 18, 2021 08:03
Atweet PHP Framework - in less that 140 bytes
require(__DIR__.'/c.php');
if(($a=!empty($_GET['r'])?$_GET['r']:'index')&&(!is_callable($a)||substr($a,0,1)=='_'))die("Ooops...");
$a();
@Awilum
Awilum / application.php
Created February 17, 2012 08:08
Tweetpl - php template engine in less that 140 bytes
<?php
include 'tweetpl.php';
$user = 'Awilum';
Tweetpl::display('profile.php', array('user' => $user));
@Awilum
Awilum / jquery.numeric.plugin.js
Created December 26, 2012 10:13
Usage: $('.phone').numeric();
// Numeric plugin
(function($) {
$.fn.numeric = function() {
return this.each(function() {
$(this).keydown(function(e) {
var key = e.charCode || e.keyCode || 0;
return (key == 8 || key == 9 || key == 46 || (key >= 35 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105));
});
});
};
@Awilum
Awilum / gist:5310118
Created April 4, 2013 12:53
Locales Array
$locales = array(
'om' => 'Afaan Oromoo',
'aa' => 'Afaraf',
'af' => 'Afrikaans',
'ak' => 'Akan',
'an' => 'aragonés',
'ig' => 'Asụsụ Igbo',
'gn' => 'Avañe\'ẽ',
'ae' => 'avesta',
'ay' => 'aymar aru',
@Awilum
Awilum / CSS Hacks!
Created May 16, 2013 06:21
CSS Hacks for IE6, IE7, IE8, FireFox, Opera, Safari, Chrome!
/* IE8 Only */
.myClass {
color:red\0/;
padding:70px\0/;
}
/* IE 6 Only */
* html .myClass {
...
}
@Awilum
Awilum / Fixing-the-iOS-orientation-viewport-zoom-bug
Created July 10, 2013 10:47
Fixing the iOS orientation / viewport zoom bug
<meta name="viewport" content="initial-scale = 1,user-scalable=no,maximum-scale=1.0">
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Editor with Preview</title>
<style type=text/css>
#editor {
width: 400px;
height: 300px;
border: 1px solid black;
@Awilum
Awilum / gist:6379965
Created August 29, 2013 15:57
Fix After IOS FullScreen Mode
function fixAfterIOSFullScreenMode() {
var flag = false;
$(window).on('resize', function(){
if ($(this).height() > 300 && (window.orientation == 90 || window.orientation == -90)) {
if(flag == false) {
$('body').scrollTop($('body').scrollTop());
flag = true;
}
} else {
flag = false;
@Awilum
Awilum / navigation.php
Last active December 20, 2018 16:12
Flextype: Navigation based on published pages
// Sort pages by pages slug
<ul class="navbar-nav">
<?php $pages = Content::getPages('', false, 'slug'); ?>
<?php foreach ($pages as $page) { ?>
<?php if ($page['slug'] !== '404' && !(isset($page['visibility']) && ($page['visibility'] === 'draft' || $page['visibility'] === 'hidden'))) { ?>
<li class="nav-item">
<a class="nav-link <?php if (Http::getUriString() == $page['slug']) echo 'active'; ?>" href="<?php echo Http::getBaseUrl().'/'.$page['slug']; ?>"><?php echo $page['title']; ?></a>
</li>
<?php } } ?>