Skip to content

Instantly share code, notes, and snippets.

View bacanu's full-sized avatar

Cosmin Bacanu bacanu

View GitHub Profile
@bacanu
bacanu / Instructions.md
Last active June 19, 2020 21:25
Read a random value from a google spreadsheet:
  1. Create a spreadsheet or open an existing one
  2. Get your spreadsheet id. If the spreadsheet has an url like https://docs.google.com/spreadsheets/d/11KRGX-DKhJvWa3rJpVvjWtPQiGKUZnOkrlQ21HKjkU4/edit, the id is 11KRGX-DKhJvWa3rJpVvjWtPQiGKUZnOkrlQ21HKjkU4
  3. Select what data you want to use by picking a range. I suggest a column and the range notation is A:A for column A, B:B for column B and so on.
  4. Go to "Tools > Script Editor"
  5. Replace everything in the file;
    Go from this:
function myFunction() {
  
}
@bacanu
bacanu / config.js
Created August 30, 2019 14:12
klaro required apps not working as expected
// By default, Klaro will load the config from a global "klaroConfig" variable.
// You can change this by specifying the "data-config" attribute on your
// script take, e.g. like this:
// <script src="klaro.js" data-config="myConfigVariableName" />
// You can also disable auto-loading of the consent notice by adding
// data-no-auto-load=true to the script tag.
var klaroConfig = {
// You can customize the ID of the DIV element that Klaro will create
// when starting up. If undefined, Klaro will use 'klaro'.
elementID: 'klaro',
@bacanu
bacanu / truncate.js
Created January 16, 2019 11:02
Truncate to n number of lines
'use strict';
var linesElement = 3; //it will truncate at 3 lines.
var truncateElement = document.getElementById('truncateme');
var truncateText = truncateElement.textContent;
var getLineHeight = function getLineHeight(element) {
var lineHeight = window.getComputedStyle(truncateElement)['line-height'];
if (lineHeight === 'normal') {
// sucky chrome
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
@bacanu
bacanu / Plugin.php
Created February 17, 2017 11:54 — forked from jblyberg/Plugin.php
Share Laravel 5.1 session and check authentication from Moxiemanager.
<?php
/*
|--------------------------------------------------------------------------
| Sharing Laravel's session and checking authentication
|--------------------------------------------------------------------------
|
| Customized Moxiemanager plugin for use in our Laravel App. We use a custom
| External authentication module, but you get the gist (ha ha) of it.
| Put the Plugin.php file in moxiemanager/plugins/LaravelAuthenticator
@bacanu
bacanu / gist:81ff5da685ed54da0be2
Created February 5, 2015 09:10
tabel cu litere
<?php
$chars = array(
'a', 'x', 'y', 'f',
'a', 'x', 'y', 'f',
'a', 'x', 'y', 'f',
'a', 'x', 'y', 'f'
);
// sa zicem ca chars are 81 de litere in el,
// doar 1 litera este cea pe care o vrei tu
<iframe width="700" height="394"
id="youtube_iframe"
src="//www.youtube.com/embed/73txXT21aZU?wmode=transparent"
frameborder="0" allowfullscreen=""></iframe>
<iframe width="700" height="394"
id="youtube_iframe"
src="//www.youtube.com/embed/73txXT21aZU?wmode=transparent"
frameborder="0" allowfullscreen=""></iframe>
@bacanu
bacanu / designer.html
Last active August 29, 2015 14:14
designer
<link rel="import" href="../ace-element/ace-element.html">
<link rel="import" href="../paper-button/paper-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
$("*[unselectable]").removeAttr("unselectable");$(".page-blur-promo-overlay").parent().remove(); $("head").append("<style>* { text-shadow: none !important; color: black !important; -webkit-user-select: initial !important; -khtml-user-drag: inital; -khtml-user-select: initial !important; -moz-user-select: initial !important; -moz-user-select: -moz-initial !important; -ms-user-select: initial !important; user-select: initial !important;}</style>");