Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
Working on @CodelyTV 😬

Javier Ferrer JavierCane

🐢
Working on @CodelyTV 😬
View GitHub Profile
View lerele.ts
type MethodKeys<T> = ({ [P in keyof T]: T[P] extends Function ? P : never })[keyof T];
type ClassProps<T> = {
[key in keyof T]:
T[key] extends { value: any }
? Pick<T[key], "value">["value"]
: T[key] extends Object
? ValueObjectPrimitives<T[key]>
: T[key];
};
@JavierCane
JavierCane / listGoogleDriveSharedDocuments.js
Last active Sep 14, 2021 — forked from woodwardtw/tellmeyoursecrets.js
Google Spreadsheet script that lists all the shared documents inside a specified folder and all its subfolders recursively. Skips out the documents shared internally (with specified email addresses)
View listGoogleDriveSharedDocuments.js
function start() {
const sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow(["Name", "Sharing Access", "Sharing Permission", "Get Editors", "Get Viewers", "Date", "Size", "URL", "Download", "Description", "Type"]);
const folder = DriveApp.getFolderById("folder_id_copied_from_the_url_without_the_google_drive_domain");
recursiveListSharedFiles(folder, sheet);
}
function recursiveListSharedFiles(folder, sheet) {
@JavierCane
JavierCane / .env
Created Feb 21, 2019
Dockerizing default Symfony project
View .env
###> Docker Compose - DB ###
MYSQL_DATABASE=symfony
MYSQL_USER=codely
MYSQL_PASSWORD=c0d3ly
###< Docker Compose - DB ###
# In all environments, the following files are loaded if they exist,
# the later taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
View CountLogTypeOnLevelsCommand.php
<?php
namespace App\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use App\Domain\LogEntry;
View DipExample.php
<?php
declare(strict_types = 1);
// ******************************************************
// ******************************************************
// 💩🔴✋ HERENCIA ✋🔴💩
// ******************************************************
// ******************************************************
@JavierCane
JavierCane / CaseClassVisibilitiesSpec.scala
Created Nov 22, 2017
Scala Case Class visibilities test example for the CodelyTV Pro Scala course 👉 https://pro.codely.tv/
View CaseClassVisibilitiesSpec.scala
// Full repo: https://github.com/CodelyTV/scala-intro-examples/
package tv.codely.scala_intro_examples.lesson_09_oop
import org.scalatest.{Matchers, WordSpec}
final class CaseClassVisibilitiesSpec extends WordSpec with Matchers {
private val randomText = "some text"
private val caseClass = CaseClass(attributeInConstruct = randomText)
"Case Class" should {
@JavierCane
JavierCane / CaseClassCapabilitiesSpec.scala
Created Nov 22, 2017
Scala Case Class capabilities test example for the CodelyTV Pro Scala course 👉 https://pro.codely.tv/
View CaseClassCapabilitiesSpec.scala
// Full repo: https://github.com/CodelyTV/scala-intro-examples/
package tv.codely.scala_intro_examples.lesson_09_oop
import org.scalatest.{Matchers, WordSpec}
/**
* In order to check all the capabilities that a case class have, just:
* * Compile it with: `scalac`
* * Inspect it with: `javap -private`
*
@JavierCane
JavierCane / StandardClassVisibilitiesSpec.scala
Created Nov 22, 2017
Scala standard class visibilities example for the CodelyTV Pro Scala course 👉 https://pro.codely.tv/
View StandardClassVisibilitiesSpec.scala
// Full repo: https://github.com/CodelyTV/scala-intro-examples/
package tv.codely.scala_intro_examples.lesson_09_oop
import org.scalatest.{Matchers, WordSpec}
final class StandardClassVisibilitiesSpec extends WordSpec with Matchers {
private val randomText = "some text"
private val standardClass = new StandardClass(attributeInConstruct = randomText)
"Standard Class" should {
@JavierCane
JavierCane / NumberWithCompanionObject.scala
Created Nov 22, 2017
Scala companion object example for the CodelyTV Pro Scala course 👉 https://pro.codely.tv/
View NumberWithCompanionObject.scala
package tv.codely.scala_intro_examples.lesson_09_oop
import scala.util.Random
object NumberWithCompanionObject {
def apply(value: String): NumberWithCompanionObject = NumberWithCompanionObject(value = value.toInt)
def random: NumberWithCompanionObject = NumberWithCompanionObject(value = Random.nextInt())
}
@JavierCane
JavierCane / CaseClass.scala
Created Nov 22, 2017
Scala case class example for the CodelyTV Pro Scala course 👉 https://pro.codely.tv/
View CaseClass.scala
package tv.codely.scala_intro_examples.lesson_09_oop
final case class CaseClass(
attributeInConstruct: String,
private val privateAttributeInConstruct: String = "Some default value"
) {
val attributeInBody = "public body attribute value"
private val privateAttributeInBody = "private body attribute value"
}