Skip to content

Instantly share code, notes, and snippets.

View bueckl's full-sized avatar

Jochen Gülden bueckl

View GitHub Profile
@bueckl
bueckl / wget
Last active October 11, 2023 08:05
Wget examples
#Spider Websites with Wget – 20 Practical Examples
Wget is extremely powerful, but like with most other command line programs, the plethora of options it supports can be intimidating to new users. Thus what we have here are a collection of wget commands that you can use to accomplish common tasks from downloading single files to mirroring entire websites. It will help if you can read through the wget manual but for the busy souls, these commands are ready to execute.
1. Download a single file from the Internet
wget http://example.com/file.iso
2. Download a file but save it locally under a different name
wget ‐‐output-document=filename.html example.com
@bueckl
bueckl / ServerVars.php
Created February 10, 2017 10:52
PHP Server Vars
$_SERVER["DOCUMENT_ROOT"] === /home/user/public_html
$_SERVER["SERVER_ADDR"] === 143.34.112.23
$_SERVER['HTTP_HOST'] === example.com (or with WWW)
$_SERVER["REQUEST_URI"] === /folder1/folder2/yourfile.php?var=blabla
__FILE__ === /home/user/public_html/folder1/folder2/yourfile.php
basename(__FILE__) === yourfile.php
__DIR__ === /home/user/public_html/folder1/folder2 [same: dirname(__FILE__)]
$_SERVER["QUERY_STRING"] === var=blabla
$_SERVER["REQUEST_URI"] === /folder1/folder2/yourfile.php?var=blabla
@bueckl
bueckl / SearchContext.php
Last active February 5, 2017 20:54
ModelAdmin Custom Search #SearchContext #Search on has_many Relation #SS3 #Silverstripe
<?php
class YachtAdmin extends ModelAdmin {
private static $managed_models = array(
'Yacht'
);
public function getSearchContext(){
@bueckl
bueckl / RenameTab.php
Created February 5, 2017 20:00
Rename Tab SS3 #Sivlerstripe
public function getCMSFields() {
$fields = parent::getCMSFields();
$MainTab = $fields->findOrMakeTab(
"Root.Main"
);
$MainTab->setTitle('NEW TITLE');
@bueckl
bueckl / scrollcheck.js
Created July 26, 2016 13:38
Scroll Check -> Scroll Out/In Nav on mobile Devices
add to app.js on very top:
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];
}
@bueckl
bueckl / dropdown.js
Last active June 13, 2016 16:19
Make Dropdown Menu work on Touch devices
function isTouchDevice() {
return 'ontouchstart' in document.documentElement;
}
// Hack to make dropdown menu work on touch devices
var el = $('#main-nav ul.nav > li.dropdown-large a.dropdown-toggle');
/* If mobile browser, prevent click on parent nav item from redirecting to URL */
@bueckl
bueckl / Social.ss
Created April 4, 2016 08:36
Social Icons Example including OpenGraph Meta Data etc, #SS3 #FontAwesome
<div class="social-icons well">
<meta property="og:title" content="$Item.T('OpenImmoObjekttitel')" />
<meta property="og:type" content="website" />
<meta property="og:url" content="$Item.CanonicalLinkURL" />
<meta property="og:image" content="$Item.ImmoImages.First.Image.CroppedWatermarkedImage(470,246).AbsoluteURL" />
<meta property="og:site_name" content="mallorca-immobilien-guide.de" />
<meta property="og:description" content="$Item.T('OpenImmoObjektbeschreibung')" />
@bueckl
bueckl / i18n.yml
Created January 5, 2016 14:39
Order Translations YML #SilverStripe
---
Name: customi18n
Before: 'defaulti18n'
---
i18n:
module_priority:
- mysite
- othermodule
@bueckl
bueckl / JSON2Template
Created December 11, 2015 10:33
#Silverstripe Convert JSON Data to ArrayData for Template
//http://stackoverflow.com/questions/19888110/silverstripe-convert-twitter-json-string-to-dataobject-to-loop-though-in-templa
public static function getTwitterFeed(){
$settings = array(
'oauth_access_token' => "xxx",
'oauth_access_token_secret' => "xxx",
'consumer_key' => "xxx",
'consumer_secret' => "xxx"
);
@bueckl
bueckl / FadeInOutOnScrollDown
Last active November 28, 2015 19:05
Fadeout on Scroll
$(window).on('scroll', function() {
var header = $("header");
var scrollBottom = $(document).height() - $(this).scrollTop() - $(this).height();
if ($(this).scrollTop() > 350 && scrollBottom > 450 ) {
if (!header.data('faded')) header.data('faded', 1).stop(true).fadeTo(400, 0);
} else if (header.data('faded')) {
header.data('faded', 0).stop(true).fadeTo(400, 1);
}
});