Skip to content

Instantly share code, notes, and snippets.

View CanRau's full-sized avatar
🤓
coding

Can Rau CanRau

🤓
coding
View GitHub Profile
@somatonic
somatonic / MapPageField.module
Created December 19, 2012 08:32
maps two page fields POC
<?php
class MapPageField extends WireData implements Module{
public static function getModuleInfo(){
return array(
'title' => 'MapPageField',
'version' => 100,
'singular' => true,
'autoload' => true
@matharchod
matharchod / gist:6137053
Last active December 20, 2015 13:09
jQuery function to scroll to anchor point on page load (split by hash/pound sign)
//scroll to anchor point on page load
function scrollOnLoad() {
try {
//take HREF and split at anchor
var $_elem = $('#' + $(location).attr('href').split('#')[1]);
//find class of anchor element
var $_others = $('.' + $_elem.attr('class'));
//measure window height and element height
//if the window height is smaller that twice the element height, then use regular offset
@Da-Fecto
Da-Fecto / templates-folder-switch.php
Last active May 6, 2016 05:23
Templates folder switch for ProcessWire
<?php
/**
* Switch ProcessWire templates directory on $_SERVER['HTTP_HOST']. Type the
* Hostname as key and the name of the new templates folder as value.
*
*/
$config->templates = array(
'mobile.domain.dev' => 'templates-mobile', // domain => templates folder name
@kentcdodds
kentcdodds / README.md
Created October 25, 2017 22:01
Rendering a function with React

Rendering a function with React

No, this isn't about render props

I'm going to clean this up and publish it in my newsletter next week!

Context

So react-i18n (not the npm one... one we made at PayPal internally) has this

@CanRau
CanRau / gtm-utm-remover.js
Last active April 22, 2019 04:11
Removes all query parameters from the url beginning with 'utm_', leaves anchors (#) and other query params alone
/**
* GTM utm_ remover
* License: MIT
* Author: @CanRau
* Version: 0.2.0
*
* Removes all query parameters from the url beginning with 'utm_'
* Leaves anchors (#) and other query params alone, so
* example.com/?session=SESSIONID&utm_source=instagram#content
* would become
@aruld
aruld / multiline.dart
Created October 19, 2011 17:26
Dart String interpolation and multi-line Strings
main() {
var user = 'John Doe';
var message = """
$user!
Welcome to Programming Dart!
""";
print(message);
}
@somatonic
somatonic / upload_images_to_page_form.php
Created November 26, 2012 22:08
Upload Images to new created Page Form Example
<?php
// front-end form example with multiple images upload
// add new page created on the fly and adding images
$message = '';
if($input->post->submit){
// tmp upload folder for additional security

Keybase proof

I hereby claim:

  • I am canrau on github.
  • I am canrau (https://keybase.io/canrau) on keybase.
  • I have a public key ASDcjXYRMtWtmJKpTow9SS7FahCJbrnILp30C51yJrH_7Ao

To claim this, I am signing this object:

@JakeGinnivan
JakeGinnivan / Pulumi.yaml
Last active January 12, 2023 10:17
Pulumi /w TypeScript project references + dynamodb lock
name: serverless-mono
description: Serverless mono infrastructure
backend:
url: s3://my-pulumi-state-bucket
runtime:
name: nodejs
options:
typescript: false
lock:
region: ap-southeast-2