Skip to content

Instantly share code, notes, and snippets.

@cmparlettpelleriti
cmparlettpelleriti / R_EigenPCA_Plots.R
Last active April 19, 2024 01:51
Show students the relationship between Eigendecomp of Cor/Cov and the % variance explained for PCs
library(tidyverse)
library(MASS)
library(patchwork)
cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
# generate data with given cor matrix
a <- 0.9
s1 <- matrix(c(1,a,
a,1), ncol = 2)
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active April 19, 2024 01:50
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@MikuroXina
MikuroXina / endless-error-loop.py
Created December 26, 2022 15:50
Lyrics of "Endless Error Loop" by Neko Hacker feat. ななひら.
print('''<header>
ここをもうちょっとシンプルに変えてっと
え、なにこのエラー・・・
</header>''')
try:
uglyCode()
except:
print('よくあるError')
try:
@scriptdev
scriptdev / .php
Last active April 19, 2024 01:48
DEFINIR OS BOTÕES DE AÇÃO DO THtmlEditor
<?php
$html = new THtmlEditor('texto');
$html->setOption('toolbar',[
['style', ['bold', 'italic', 'underline', 'clear']],
['font', ['strikethrough', 'superscript', 'subscript']],
['fontsize', ['fontsize']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
@scriptdev
scriptdev / .php
Created December 12, 2023 16:38
RETORNAR IDS ARRAY DOS REGISTROS VINCULADOS
<?php
$GruposCliente = GruposCliente::where('cliente_id', '=', $object->id)->getIndexedArray('grupo_cliente_id', 'grupo_cliente_id');
/*
Array
(
[1] => 1
[2] => 2
[4] => 4
@JNNGL
JNNGL / generator.py
Last active April 19, 2024 01:47
Animated emojis in vanilla Minecraft
#!/usr/bin/python3
import math
import argparse
from PIL import Image
def build_frames(gif, animation_seconds):
num_frames = math.floor(gif.n_frames)
frame_width, frame_height = gif.size
@scriptdev
scriptdev / .php
Created December 12, 2023 18:28
CABEÇALHO DE RELATÓRIO TABULAR
<?php
$tr->addStyle('title', 'Courier', '10', 'B', '#000000', '#dbdbdb');
if ($format == 'pdf')
{
$tr->setHeaderCallback(
function($tr)
{
$pdf = $tr->getNativeWriter();
@scriptdev
scriptdev / .php
Created December 14, 2023 21:26
ATUALIZAR DATAGRID MÉTODO A CADA TEMPO
<?php
public function __construct($param = null)
{
parent::__construct();
$this->form = new BootstrapFormBuilder(self::$formName);
$this->form->setFormTitle("PEDIDOS - DELIVERY");
$this->limit = 20;
@USM-F
USM-F / MCKP.py
Last active April 19, 2024 01:45
Dynamic programming solution of Multiple-Choice Knapsack Problem (MCKP) in Python
#groups is list of integers in ascending order without gaps
def getRow(lists, row):
res = []
for l in lists:
for i in range(len(l)):
if i==row:
res.append(l[i])
return res
@scriptdev
scriptdev / .php
Created December 16, 2023 00:47
SIMULAR FOCO NO CAMPO
<?php
TScript::create('$("[name=\'NOME_CAMPO\']").blur();');