Skip to content

Instantly share code, notes, and snippets.

@LostKobrakai
LostKobrakai / gist:4612374
Created January 23, 2013 20:05
short Array dump
function dump($data, $depth=0){
foreach($data as $key => $item){
for($i=0; $i < $depth; $i++){
echo "\t";
}
if(is_string($item)) $item = "String";
echo $key." -> ".$item."\n";
if(is_array($item)) dump($item, $depth+1);
}
}
@LostKobrakai
LostKobrakai / gist:4702028
Created February 3, 2013 14:38
Best Favicon for all the websters
<link rel="apple-touch-icon" href="path/to/touchicon.png">
<link rel="icon" href="path/to/favicon.png">
<!--[if IE]><link rel="shortcut icon" href="path/to/favicon.ico"><![endif]-->
<!-- or, set /favicon.ico for IE10 win -->
<meta name="msapplication-TileColor" content="#D83434">
<meta name="msapplication-TileImage" content="path/to/tileicon.png">
@LostKobrakai
LostKobrakai / gist:5697485
Last active December 18, 2015 00:38
Paul Irish setInterval() alternative
(function(){
doStuff();
setTimeout(arguments.callee, 100);
})();
@LostKobrakai
LostKobrakai / mobile-win8-viewportfix.js
Created June 4, 2013 19:39
Fix for mobile win 8 viewports
(function() {
if ("-ms-user-select" in document.documentElement.style && navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement("style");
msViewportStyle.appendChild(
document.createTextNode("@-ms-viewport{width:auto!important}")
);
document.getElementsByTagName("head")[0].appendChild(msViewportStyle);
}
})();
@LostKobrakai
LostKobrakai / index.html
Created September 25, 2013 19:10
Rich Radio buttons by Travis Arnold (http://cssdeck.com/labs/ldmtsmfk)
<div>
<input type="radio" name="radio" id="radio1" class="radio" checked/>
<label for="radio1">First Option</label>
</div>
<div>
<input type="radio" name="radio" id="radio2" class="radio"/>
<label for="radio2">Second Option</label>
</div>
@LostKobrakai
LostKobrakai / 0_reuse_code.js
Created September 28, 2013 22:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
read -e IMAGE;
defaults write com.apple.desktop Background "{default = {ImageFilePath='$IMAGE'; };}"
killall Dock
@LostKobrakai
LostKobrakai / fieldRemove.php
Last active August 29, 2015 14:06
ProcessWire: Remove field via API
<?php
if ($user->isSuperuser()) {
//first remove the fields from 'user' template before deleting them.
$t = $templates->get('user');
$fg = $t->fieldgroup;
$fg->remove($fields->get('your_field'));
$fg->save();
//delete the fields
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
a, img{
display: block;
}
@LostKobrakai
LostKobrakai / gist:d09128adf13bbf588679
Created February 2, 2015 17:27
Combine each element to another.
<?php
$array = ["lot's", "of", "elements", "…"];
$allConcatinations = [];
for ($a=0; $a<count($array); $a++) {
for ($b=$a+1; $b<count($array); $b++) {
array_push($allConcatinations, $array[$a]." ".$array[$b]);
}
}