Skip to content

Instantly share code, notes, and snippets.

View egfx's full-sized avatar
💭
gif.com.ai

Ilya egfx

💭
gif.com.ai
View GitHub Profile
@egfx
egfx / gist:7cc8d3f8b91c4a5efd9b
Created August 5, 2011 23:37
Replace a key in an associative array, preserving the original order of keys and elements:
<?php
if (!function_exists('array_combine')) { // ONLY EXISTS IN PHP5
function array_combine($keys, $values) {
if (count($keys) != count($values)) {
return false; }
foreach($keys as $key) { $array[$key] = array_shift($values); }
return $array; }
} // END IF FUNCTION EXISTS
$keys = array_keys($array);
@egfx
egfx / gist:1129773
Created August 6, 2011 21:33
StdClass Object to Array
<?php
//Codeigniter Helper function created based on PHP manual Objects, http://www.php.net/manual/en/language.types.object.php#102735
function object_to_array(stdClass $Class){
# Typecast to (array) automatically converts stdClass -> array.
$Class = (array)$Class;
# Iterate through the former properties looking for any stdClass properties.
# Recursively apply (array).
$scope.safeApply = function(fn) {
var phase = this.$root.$$phase;
if(phase == '$apply' || phase == '$digest') {
if(fn && (typeof(fn) === 'function')) {
fn();
}
} else {
this.$apply(fn);
}
};
@egfx
egfx / gist:ec496cafe61db369bde9
Last active August 29, 2015 14:16
Find the physically closest DOM element
(function($){
$.fn.physicallyClosest = function() {
var $this = this,
selector = "body *",
options;
if(typeof arguments[0] === "string") {
selector = arguments[0];
}
else if(typeof arguments[0] === "object") {
options = arguments[0];
@egfx
egfx / gist:b0aba0a4b11938d29149
Last active December 11, 2016 19:51
Magic Eye Widget 4 Project Grid Editor
<div oc-lazy-load="[
'https://cdn.rawgit.com/peeinears/MagicEye.js/master/magiceye.min.js',
'https://cdn.rawgit.com/peeinears/MagicEye.js/master/depthmappers/CanvasDepthMapper.js',
'https://cdn.rawgit.com/jwarby/jquery-awesome-cursor/master/src/jquery.awesome-cursor.js'
]">
<magiceye id="magic-eye">
<div class="Absolute-Center polaroid">
<div class="magic-eye-wrapper">
<canvas style="display:hidden;" id="magic-eye-canvas" width="540" height="400">Sorry, your browser doesn't support HTML5 Canvas!</canvas>
</div>
body
{
margin:0;
padding:0;
background: #e9f5ff; /* Old browsers */
background: -moz-linear-gradient(top, #e9f5ff 10%, #ffffff 90%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(10%,#e9f5ff), color-stop(90%,#ffffff)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #e9f5ff 10%,#ffffff 90%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #e9f5ff 10%,#ffffff 90%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #e9f5ff 10%,#ffffff 90%); /* IE10+ */
/*
* Character Count Plugin - jQuery plugin
* Dynamic character count for text areas and input fields
* written by Alen Grakalic
* http://cssglobe.com/post/7161/jquery-plugin-simplest-twitterlike-dynamic-character-count-for-textareas
*
* Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
@egfx
egfx / data.csv
Last active November 4, 2015 23:27
searchable guids
43f72bc4-551e-4c63-b431-a776e549e8c1 c48fb450-44ee-4acd-8d54-3e9193694cb4 532ee27d-4593-4eae-8c68-47d8f216fd67 d420aa42-2ad7-4cc1-8b3a-70b6adcad229 6a408977-b766-4937-a8b4-26ff8c2f03a0 eb22c41b-9cea-4ac4-b651-e32e81973732 98ec9444-d204-45bc-bb39-e37c23792bee 7eddf277-d795-4a5a-af55-0a8bea234a25 0a0a04b3-d676-41ea-84be-1f9856bfb875 15a71bec-5d14-46a5-83fc-12532fcb7ce2 e2269b3b-06b8-484e-acfc-096c780408e1 10edf43f-94a4-4f44-a60e-64943960873c 9397277c-512b-47a9-91c5-45fc14e148c4 2f09545d-05b8-45db-ad92-823791d0913c
@import url(http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css);
#arcade-button
{background-color: #F7F7F7;}
#arcade-button
.roundbtn {
width: 75px;
height: 75px;
border: 5px solid #9a9a9a;
#vhs-pause{
font-family: 'Press Start 2P', #vhs-pause cursive;
background: #171DA8;
overflow: hidden;
animation: blue-me 5ms infinite;
}
#vhs-pause
:after {
box-shadow: inset 0 0 10em rgba(0, #vhs-pause0, #vhs-pause0, #vhs-pause0.75);
position: absolute;