View example-typeorm-jest.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createConnection, getConnection, Entity, getRepository } from "typeorm"; | |
import { PrimaryGeneratedColumn, Column } from "typeorm"; | |
@Entity() | |
export class MyEntity { | |
@PrimaryGeneratedColumn() | |
id?: number; | |
@Column() | |
name?: string; |
View dirname-filename-basename.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set filepath="C:\some path\having spaces.txt" | |
for /F "delims=" %%i in (%filepath%) do set dirname="%%~dpi" | |
for /F "delims=" %%i in (%filepath%) do set filename="%%~nxi" | |
for /F "delims=" %%i in (%filepath%) do set basename="%%~ni" | |
echo %dirname% | |
echo %filename% | |
echo %basename% |
View Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "yourpackage" | |
version = "0.1.0" | |
authors = ["John Doe"] | |
edition = "2018" | |
[[bin]] | |
name = "example" | |
path = "stream-a-file-using-rust-hyper.rs" |
View run-powershell-command-once-scheduled.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$t = New-ScheduledTaskTrigger -Once -At (get-date).AddSeconds(10); $t.EndBoundary = (get-date).AddSeconds(60).ToString('s'); Register-ScheduledTask -Force -TaskName JustTrying -Action (New-ScheduledTaskAction -Execute "powershell.exe" -Argument '-NoProfile -WindowStyle Hidden -command "& {dir}"') -Trigger $t -Settings (New-ScheduledTaskSettingsSet -DeleteExpiredTaskAfter 00:00:01) |
View paytrail-example-without-nonsense.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', 1); | |
error_reporting(E_ALL); | |
use Paytrail\SDK\Client; | |
use Paytrail\SDK\Exception\HmacException; | |
use Paytrail\SDK\Exception\ValidationException; | |
use Paytrail\SDK\Model\Address; | |
use Paytrail\SDK\Model\CallbackUrl; | |
use Paytrail\SDK\Model\Customer; |
View sqlite3_update_hook.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Data.Sqlite; | |
using Microsoft.EntityFrameworkCore; | |
using SQLitePCL; | |
static public class Thing { | |
public static void ListenSqlite(DbContext context) | |
{ | |
context.Database.OpenConnection(); | |
var c = context.Database.GetDbConnection() as SqliteConnection; | |
SQLitePCL.raw.sqlite3_update_hook(c.Handle, test_func, new object()); |
View cloudflare-dyndns-a-aaaa-record-update.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Jari Pennanen | |
# Url: https://gist.github.com/Ciantic/4e543f2d878a87a38c25032d5c727bf2 | |
AUTH_EMAIL="john.doe@example.com" # Your Cloudflare email | |
AUTH_KEY="" # Get this from My profile -> API Keys -> View | |
DOMAIN="example.com" # main domain | |
SUBDOMAIN="home.example.com" # set A and AAAA-record of this subdomain |
View seo-framework-disable-content-image.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Disable article images that come from the content e.g. first <img /> tag | |
add_filter('the_seo_framework_image_generation_params', function( $params, $args, $context ) { | |
if (isset( $params['cbs']['content'])) { | |
unset($params["cbs"]["content"]); | |
} | |
return $params; | |
}, 11, 3); |
View keyboardlistener.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Runtime.InteropServices; | |
using System.Runtime.CompilerServices; | |
using System.Windows.Input; | |
using System.Windows.Threading; | |
using System.Collections.Generic; | |
namespace Ownskit.Utils | |
{ |
View YAML-to-JSON-with-Rust.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Yaml to JSON with Rust | |
// Dependencies serde_yaml and serde_json | |
// https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3ddd4d9a65f03b717eeb1258299e9503 | |
fn main() { | |
let json_value: serde_json::Value = serde_yaml::from_str(&" | |
--- | |
test: some value here | |
another: value here | |
third: |
NewerOlder