Skip to content

Instantly share code, notes, and snippets.

View dreammonkey's full-sized avatar

Diederik van Remoortere dreammonkey

  • TBWA Belgium
  • Antwerp, Belgium
View GitHub Profile
@jpswade
jpswade / SqliteTrait.php
Created August 1, 2021 10:35
Laravel - no such function: CONCAT sqlite
<?php
namespace App\Traits;
use Illuminate\Database\SQLiteConnection;
use Illuminate\Support\Facades\DB;
trait SqliteTrait
{
protected static function setUpSqlite(): void
@ghandic
ghandic / pil_s3.py
Last active March 15, 2024 14:16
Load image from S3 directly into memory as PIL image and write to S3 directly from memory from PIL image
import boto3
from PIL import Image
from io import BytesIO
import os
class S3ImagesInvalidExtension(Exception):
pass
class S3ImagesUploadFailed(Exception):
pass
@walkoncross
walkoncross / numpy-image-bgr-to-rgb.md
Last active March 20, 2023 16:49
Numpy / OpenCV image BGR to RGB

(from https://www.scivision.co/numpy-image-bgr-to-rgb/)

Numpy / OpenCV image BGR to RGB

Conversion between any/all of BGR, RGB, and GBR may be necessary when working with Matplotlib expects M x N x 3 image, where last dimension is RGB.

OpenCV expects M x N x 3 image, where last dimension is BGR.

Scientific Cameras, some of which output an M X N x 3 image, where last dimension is GBR

@lmcneel
lmcneel / remove-node-modules.md
Last active June 22, 2024 15:08
How to remove node_modules after they have been added to a repo

How to remove node_modules

Create a .gitignore file

  1. Check for an existing .gitignore file in the project directory
ls -a
@Chaser324
Chaser324 / GitHub-Forking.md
Last active June 16, 2024 07:13
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@vicro
vicro / gist:5829162
Last active February 16, 2024 07:23
Retina Display for CreateJS
var canvas, stage, exportRoot;
function init() {
canvas = document.getElementById("canvas");
//Setup the canvas widht and height with devicePixelRatio. And set CSS width and height properties.
var w = 320;
var h = 357;
canvas.width = w * window.devicePixelRatio;
canvas.height = h * window.devicePixelRatio;
@allentong
allentong / console.log fallback
Created May 30, 2012 16:10
Console.Log Fallback for Javascript
var alertFallback = false;
if (typeof console === "undefined" || typeof console.log === "undefined") {
console = {};
if (alertFallback) {
console.log = function (msg) {
alert(msg);
};
} else {
console.log = function () { };
}
@geuis
geuis / remote-typeahead.js
Created February 16, 2012 22:58
Remote data querying for Twitter Bootstrap 2.0 Typeahead without modifications
<script>
// Charles Lawrence - Feb 16, 2012. Free to use and modify. Please attribute back to @geuis if you find this useful
// Twitter Bootstrap Typeahead doesn't support remote data querying. This is an expected feature in the future. In the meantime, others have submitted patches to the core bootstrap component that allow it.
// The following will allow remote autocompletes *without* modifying any officially released core code.
// If others find ways to improve this, please share.
var autocomplete = $('#searchinput').typeahead()
.on('keyup', function(ev){
ev.stopPropagation();
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//