Skip to content

Instantly share code, notes, and snippets.

View bacanu's full-sized avatar

Cosmin Bacanu bacanu

View GitHub Profile
@bacanu
bacanu / d3.js_redditfp.html
Last active October 10, 2015 22:48
a content layout using d3.js, lightweight-jsonp and jquery-full-house
<!-- things you will need -->
<script src = 'http://code.jquery.com/jquery-1.8.2.min.js' ></script>
<script src = 'http://d3js.org/d3.v2.min.js' ></script>
<script src = 'https://raw.github.com/IntoMethod/Lightweight-JSONP/master/jsonp.js' ></script>
<script src = 'https://raw.github.com/kuchumovn/jquery-full-house/master/jquery-full-house.js' ></script>
<script>
var treemap = d3.layout.treemap()
.sort( function(a, b ){ return a.data && b.data ? (a.data.ups - a.data.downs ) - ( b.data.ups - b.data.downs ) : 1; } ) // i'm not a very smart man
.value(function(d) {
$("*[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>");
@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%;
<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 / 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
@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
<!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 / 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
@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',