Skip to content

Instantly share code, notes, and snippets.

View spidgorny's full-sized avatar
💭
Building Flutter apps

Slawa Pidgorny spidgorny

💭
Building Flutter apps
View GitHub Profile
/**
* Get the ISO week date week number
* Matthijs: implementation is not correct!
* Added so you can grasp the idea
*/
Date.prototype.getWeek = function () {
// Create a copy of this date object
var target = new Date(this.valueOf());
// ISO week date weeks start on monday
@rsvp
rsvp / freqy.sh
Created February 18, 2012 15:43
freqy.sh : sort lines by their frequency count -- a very useful idiom as Linux bash script.
#!/usr/bin/env bash
# bash 3.2.25(1) Ubuntu 7.10 Date : 2012-02-15
#
# _______________| freqy : sort and order lines by frequency of appearance.
#
# Usage: freqy [optional: file(s)]
#
# Notes: Will work in a pipe.
# Does not alter the file(s) themselves.
#
@kevinSuttle
kevinSuttle / meta-tags.md
Last active July 10, 2024 09:39 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@shaunjohnson
shaunjohnson / .gitconfig
Created May 22, 2012 12:54
Proxy setting in .gitconfig
[http]
proxy = http://localhost:3128
@robsears
robsears / OverlayImage.py
Created December 11, 2012 17:21
Overlay an image in OpenCV using Python
# Adapted from http://www.aishack.in/2010/07/transparent-image-overlays-in-opencv/
from cv2 import *
src = cv.LoadImage("image.jpg") # Load a source image
overlay = cv.LoadImage("ghost.png") # Load an image to overlay
posx = 170 # Define a point (posx, posy) on the source
posy = 100 # image where the overlay will be placed
S = (0.5, 0.5, 0.5, 0.5) # Define blending coefficients S and D
D = (0.5, 0.5, 0.5, 0.5)
@arun057
arun057 / gist:5556563
Created May 10, 2013 18:53
mysqldump: Couldn’t execute ‘SELECT @@GTID_MODE’: Unknown system variable ‘GTID_MODE’ (1193)
# If you are using the MySQL 5.6 version of mysqldump on an older MySQL database, you might get the error message.
mysqldump: Couldn't execute 'SELECT @@GTID_MODE': Unknown system variable 'GTID_MODE' (1193)
# This error is in part due to the introduction of Global Transaction Identifiers (GTIDs) in MySQL 5.6. GTIDs make it simple to # track and compare replication across a master-slave topology.
# mysqldump tries to query this system variable, which doesn’t exist in earlier versions, and then fails. The solution is to add # –set-gtid-purged=OFF in the mysqldump command. It should look something like
mysqldump -h dbHost -u dbuser dbName --set-gtid-purged=OFF
@mitchwongho
mitchwongho / Docker
Last active June 26, 2024 07:28
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@sphvn
sphvn / traverse.js
Last active October 26, 2023 21:49
Recursively traverse object javascript, recurse json js, loop and get key/value pair for JSON
var traverse = function(o, fn) {
for (var i in o) {
fn.apply(this,[i,o[i]]);
if (o[i] !== null && typeof(o[i])=="object") {
traverse(o[i], fn);
}
}
}
// usage
@derhansen
derhansen / numJobsDatabaseDriver.php
Last active July 15, 2021 17:16
Laravel 5 - get amount of jobs in a queue (database driver)
$numJobs = DB::table('jobs')->where('queue', 'myqueue')->count();
@carcinocron
carcinocron / debugger pause beforeunload
Last active July 10, 2024 08:48
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)