Skip to content

Instantly share code, notes, and snippets.

<?php
$ent = Cooperative::load(1);
$build['obj'] = \Drupal::entityManager()->getViewBuilder('cooperative')->view($ent);
@manniru
manniru / FullExample.php
Created February 21, 2020 17:22 — forked from IamSmith/FullExample.php
Fully working example
<?php
require_once("PHPExcel/PHPExcel.php");
$phpExcel = new PHPExcel();
$styleArray = array(
'font' => array(
'bold' => true,
)
);

@Hannahdouken has outsmarted the t-shirt bots stealing people's designs on Twitter.

This is a blocklist for the sites caught up in the sting operation. Below is a table with the offending sites and links, some of them archived for perpetuity, so you can add them to a blocking service like uBlock Origin and Pi-hole. All you have to do is add this link to your blocklist:

https://gist.githubusercontent.com/ndarville/6da8247493e8c06daaf306bb6c4b2c29/raw/7582b3cc7c9c8d2018ba2bd8b7b05a8f8a272cb1/blocklist.txt

For more, check out Waxy.org's coverage.

Please add your own links in the comments.

@LukeMathWalker
LukeMathWalker / .gitlab-ci.yml
Last active May 1, 2024 12:28
GitLab CI - Rust setup
image: "rust:latest"
default:
before_script:
- rustc --version
- cargo --version
stages:
- test
@aidos-dev
aidos-dev / README.md
Last active May 1, 2024 12:28
How to connect Apple AirPods to Linux (Debian/Ubuntu/Mint)

How to connect Apple AirPods to Linux (Debian/Ubuntu/Mint)

Step 1.

Open your terminal.

In the root directory run the command:

sudo nano /etc/bluetooth/main.conf
@hamelsmu
hamelsmu / webhook-circleback.py
Created April 25, 2024 04:59
Generate a project proposal automatically from a meeting transcript
from fastapi import Request, HTTPException
from pydantic import BaseModel, BaseModel, HttpUrl
from modal import Secret, App, web_endpoint, Image
from typing import Optional, List
from example import proposal
import os
app = App(name="circleback", image=Image.debian_slim().pip_install("openai", "pydantic", "fastapi"))
class Attendee(BaseModel):
@breandan
breandan / Thing.kt
Last active May 1, 2024 12:28
Type safe builder pattern in Kotlin using Phantom Types (inspired by http://blog.rafaelferreira.net/2008/07/type-safe-builder-pattern-in-scala.html)
import Thing.*
fun main() {
val foo0: Thing = Thing.setB(2).setA(1).setC(3).setD(4).build()
println("foo0: $foo0")
val foo1: Thing = Thing.setA(1).setB(2).setC(3).setD(4).build()
println("foo1: $foo1")
val foo2: Thing = Thing.setC(3).setB(2).setA(1).setD(4).build()
println("foo2: $foo2")
// val foo3: Thing = Thing.setA(1).setB(2).setC(3).build() // Compile error
@ndarville
ndarville / README.md
Last active May 1, 2024 12:28
From CSV to HTML table (Simple)

This code generates an HTML table based from a CSV file. This is from the tutorial by Christophe Viau.

In trying his code example, I discovered that the code doesn't work as-is, so I figured others might like to see a working d3.js example that did not rely on a pre-existing container HTML element.

The code remains the same except for some cosmetic tweaks.

The task of writing the CSS is left as an exercise for the reader.

@manniru
manniru / README.md
Created February 4, 2020 07:24 — forked from ndarville/README.md
From CSV to HTML table (Simple)

This code generates an HTML table based from a CSV file. This is from the tutorial by Christophe Viau.

In trying his code example, I discovered that the code doesn't work as-is, so I figured others might like to see a working d3.js example that did not rely on a pre-existing container HTML element.

The code remains the same except for some cosmetic tweaks.

The task of writing the CSS is left as an exercise for the reader.

var httpWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("https://trs.requestcatcher.com/test");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
using (var streamWriter = new System.IO.StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{\"id\":" + number +"," + "\"tag\":" + "\"" + tagid + "\"" + "}";
streamWriter.Write(json);