Skip to content

Instantly share code, notes, and snippets.

View CanRau's full-sized avatar
🤓
coding

Can Rau CanRau

🤓
coding
View GitHub Profile
@CanRau
CanRau / jquery-to-vanilla-js.md
Last active August 29, 2015 14:26 — forked from jhafner/jquery-to-vanilla-js.md
jQuery methods in vanilla JavaScript.

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@CanRau
CanRau / gist:9f70d68066983e669167
Last active October 23, 2017 04:49
Get Pinterest full size images
$json = file_get_contents('https://api.pinterest.com/v3/pidgets/boards/Globetrawter/natural-homes/pins/');
$jsonIterator = new RecursiveIteratorIterator(
new RecursiveArrayIterator(json_decode($json, TRUE)),
RecursiveIteratorIterator::SELF_FIRST);
foreach ($jsonIterator as $key) {
// get only url you can var_dump($key) and see what you like ;-)
if(isset($key['url']) && strpos($key['url'], '.jpg') !== false) {
<?php
/* Batch delete all fields containing order_ in name */
foreach($fields->find("name%=order_") as $field) {
$fields->delete($field);
if (!$fields->get($field)) echo "<p>field {$field->name} was deleted.</p>";
}
/* list all templates and provide ability to delete unused ones */
if ($input->post->submit) {
// Override limit based on user input
if($userLimit = (int) $input->get->limit) {
$remeberLimit = "?limit=$userLimit";
$limit = $userLimit;
$input->whitelist('limit', $limit);
}
// Get year filter
if($userYear = (int) $sanitizer->selectorValue($input->get->year)) {
$year = $userYear;
<?php
/**
* Roskis
*
* Adds custom trash view that can be also accessed by defined roles
* Pages in trash can be searched, sorted and restored.
*
*
* Copyright 2013 by Antti Peisa