Skip to content

Instantly share code, notes, and snippets.

View alpenzoo's full-sized avatar

Narcis Iulian Paun alpenzoo

View GitHub Profile
<?php
// PHP Simple Proxy
// Responds to GET or POST
//I would use session or other checks to prevent abuse.
//do not put it in the wild without limiting usage to a domain, list of urls etc
$url = ($_POST['url']) ? $_POST['url'] : $_GET['url'];
$url = urldecode($url);
if(empty($url)){
@alpenzoo
alpenzoo / compose.es6.js
Created April 25, 2019 14:05 — forked from jaawerth/compose.es6.js
ES5 and ES6 implementations of compose - readable implementation, not optimized
function compose(...fnArgs) {
const [first, ...funcs] = fnArgs.reverse();
return function(...args) {
return funcs.reduce((res, fn) => fn(res), first(...args));
};
}
@alpenzoo
alpenzoo / jquery.deferred.promise.js
Created December 5, 2018 14:04 — forked from pbojinov/jquery.deferred.promise.js
simple jQuery Deferred example
function getData() {
var deferred = $.Deferred();
$.ajax({
'url': 'http://google.com',
'success': function(data) {
deferred.resolve('yay');
},
'error': function(error) {
deferred.reject('boo');
@alpenzoo
alpenzoo / index.html
Created September 21, 2018 12:08 — forked from romaricdrigon/index.html
Minimal HTML boilerplate
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</head>
<body>
@alpenzoo
alpenzoo / traverse.js
Created September 14, 2018 08:10 — forked from tushar-borole/traverse.js
Object tree traversal in javascript (with lodash)
var data = {
"name": "root",
"contents": [
{
"name": "A",
"contents": [
{
"name": "fileA1",
"contents": []
}
@alpenzoo
alpenzoo / GoogleMapDivider.php
Created July 16, 2018 14:33 — forked from jamestomasino/GoogleMapDivider.php
PHP file to divide up a large image into Google Map tiles
<?php
//Larger images can require more memory and time
ini_set('memory_limit','2048M');
ini_set('max_execution_time','300');
//For testing purposes, I manually entered the input file name and destination folder
$destinationDir = 'tiles/';
$fileName = 'map.jpg';
if (!file_exists($destinationDir)) {
@alpenzoo
alpenzoo / jquery.hasattr.js
Created July 5, 2018 07:15 — forked from bjorn-ali-goransson/jquery.hasattr.js
jQuery hasAttr function
/* HAS ATTRIBUTE */
$.fn.hasAttr = function(attrName){
var element = this[0];
if(element.hasAttribute){
return element.hasAttribute(attrName);
@alpenzoo
alpenzoo / index.html
Created July 5, 2018 07:13 — forked from bjorn-ali-goransson/index.html
Minimal Bootstrap+jQuery+BootstrapJS+FontAwesome template
<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
</head><body>
<div class="container"><span class="btn btn-success"><i class="fa fa-coffee"></i></span></div>
</body></html>
@alpenzoo
alpenzoo / index.html
Created June 29, 2018 10:51 — forked from knownasilya/index.html
Google Maps Advanced Drawing
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="UTF-8">
<title>Drawing Tools</title>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false&libraries=drawing"></script>
<style type="text/css">
#map, html, body {
@alpenzoo
alpenzoo / no-scroll-to-parent.js
Last active April 23, 2018 13:27
stop mouse scroll on element
$('div').on( 'mousewheel DOMMouseScroll', function (e) {
var e0 = e.originalEvent;
var delta = e0.wheelDelta || -e0.detail;
this.scrollTop += ( delta < 0 ? 1 : -1 ) * 30;
e.preventDefault();
});