Skip to content

Instantly share code, notes, and snippets.

@remoblaser
remoblaser / google_forms_to_calendar.gs
Created March 6, 2018 13:32
This Google Forms Script adds your Form automatically to a Google Calendar
var moment = Moment.load();
var GLOBAL = {
formId : "GOOGLE FORM ID",
calendarId : "GOOGLE CALENDAR ID",
formMap : {
eventTitle: "FORM FIELD TITLE NAME",
startTime : "FORM FIELD START TIME NAME",
description: "FORM FIELD DESCRIPTION NAME",
@remoblaser
remoblaser / google_forms_to_discord.gs
Last active March 6, 2018 12:45
This Google Forms Script takes all Fields from a Form and sends it to Discord via Webhook
function onFormSubmit(e) {
var fields = [];
for (i = 0; i < e.response.getItemResponses().length; i++) {
var response = e.response.getItemResponses()[i];
fields.push({
"name": response.getItem().getTitle(),
"value": response.getResponse(),
"inline": false
});
@remoblaser
remoblaser / ct-psr2.md
Last active June 21, 2021 15:56
Sublime Text configuration for PSR-2 / cubetech

Install PHPcs

Use Sublime Text’s Package Control (Preferences -> Package Control -> Install Package -> Phpcs) to install the plugin.

Install required executables

In order for Phpcs to work, we need to install various command line tools.

  • phpcs: PHP Code Sniffer
  • php-cs-fixer: PHP Coding Standards Fixer
  • php-md: PHP Mess detector (optional)
@remoblaser
remoblaser / Language.php
Created May 30, 2016 11:09
Language Middleware for Laravel
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
@remoblaser
remoblaser / laravel-sortby-closure.md
Last active December 3, 2020 14:20
Laravel Collection: Sort a String Datefield with a closure
$sorted = $collection->sortBy(function ($element, $key) {
      $timestamp = strtotime($element->date_field);   
      return $timestamp;
});

Keybase proof

I hereby claim:

  • I am remoblaser on github.
  • I am remo (https://keybase.io/remo) on keybase.
  • I have a public key ASCI2a4E_xyI4tQmoaK6AG4434I9eMVSdzHOUr_vf6jjMwo

To claim this, I am signing this object:

Simple example of a promise in JavaScript. See "Javascript Promises explained"

<label for="amount">Post id:</label>
<input type="text" id="postId" value="1">
<button id="fetchPosts">Fetch post</button>

<div id="ajax-posts">

</div>
@remoblaser
remoblaser / parse_video_url.js
Last active August 29, 2015 14:27
Parse Youtube / Vimeo Video URL to iFrame
function getCode() {
var pattern1 = /(?:http?s?:\/\/)?(?:www\.)?(?:vimeo\.com)\/?(.+)/g;
var pattern2 = /(?:http?s?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?(.+)/g;
var regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
var video = "https://vimeo.com/58821159";
if(pattern1.test(video)) {
var video_id = video.split('/');
var id = video_id[video_id.length -1];
@remoblaser
remoblaser / dom-reload.js
Created August 12, 2015 11:27
Force a DOM Reload if Google Chrome decides to fail on OSX
var forceRedraw = function(element){
var disp = element.style.display;
element.style.display = 'none';
var trick = element.offsetHeight;
element.style.display = disp;
};