Skip to content

Instantly share code, notes, and snippets.

Avatar

Remo remoblaser

View GitHub Profile
@remoblaser
remoblaser / google_forms_to_calendar.gs
Created Mar 6, 2018
This Google Forms Script adds your Form automatically to a Google Calendar
View google_forms_to_calendar.gs
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 Mar 6, 2018
This Google Forms Script takes all Fields from a Form and sends it to Discord via Webhook
View google_forms_to_discord.gs
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 Jul 10, 2017
Sublime Text configuration for PSR-2 / cubetech
View ct-psr2.md

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
Language Middleware for Laravel
View Language.php
<?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 May 12, 2016
Laravel Collection: Sort a String Datefield with a closure
View laravel-sortby-closure.md
$sorted = $collection->sortBy(function ($element, $key) {
      $timestamp = strtotime($element->date_field);   
      return $timestamp;
});
View keybase.md

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:

View js-promise.md

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 Aug 29, 2015
Parse Youtube / Vimeo Video URL to iFrame
View parse_video_url.js
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 Aug 12, 2015
Force a DOM Reload if Google Chrome decides to fail on OSX
View dom-reload.js
var forceRedraw = function(element){
var disp = element.style.display;
element.style.display = 'none';
var trick = element.offsetHeight;
element.style.display = disp;
};
You can’t perform that action at this time.