Skip to content

Instantly share code, notes, and snippets.

View birjj's full-sized avatar

Johan Fagerberg birjj

View GitHub Profile
@birjj
birjj / gist:d5ecaa76674982019a6e
Created March 30, 2015 17:33
(Much) faster tzdetect.js
var tzdetect = {
tzs: moment.tz.names(),
matches: function(){
return this.offsetToTimezone[(new Date()).getTimezoneOffset()];
}
};
// compute (new Date()).getTimezoneOffset value for all timezones, store in tzdetect.offsetToTimezone
(function(tzdetect){
var outp = {},
@birjj
birjj / euler_numerical_solver.js
Last active December 17, 2015 00:51
En hurtig implementation af Eulers metode til numerisk løsning af koblede differentialligninger, til brug i min SRP
/**
* PLEASE READ:
* This is a very simple implementation of Eulers method for
* numerically solving coupled differential equations, used
* in an article of mine. It outputs the data in a CSV format
* (which is plaintext).
*
* To run the code, press F12, go to the Console tab of the window
* that opens, and paste the code (that's everything with the
* line numbers, as seen to the left, beside it) in there.
This file has been truncated, but you can view the full file.
[{"pid":5115,"tid":2,"ts":55785933982,"ph":"X","cat":"toplevel","name":"MessagePumpLibevent::OnLibeventNotification","args":{"fd":218},"dur":63,"tdur":59,"tts":50664},
{"pid":5115,"tid":2,"ts":55785934013,"ph":"X","cat":"ipc,toplevel","name":"ChannelReader::DispatchInputData","args":{"class":61,"line":61},"dur":26,"tdur":25,"tts":50693,"bind_id":"0x4caa5302","flow_in":true},
{"pid":5115,"tid":2,"ts":55786434450,"ph":"X","cat":"toplevel","name":"MessagePumpLibevent::OnLibeventNotification","args":{"fd":218},"dur":39,"tdur":37,"tts":50743},
{"pid":5115,"tid":2,"ts":55786434464,"ph":"X","cat":"ipc,toplevel","name":"ChannelReader::DispatchInputData","args":{"class":61,"line":61},"dur":21,"tdur":20,"tts":50756,"bind_id":"0x4caa7d02","flow_in":true},
{"pid":5115,"tid":2,"ts":55786934731,"ph":"X","cat":"toplevel","name":"MessagePumpLibevent::OnLibeventNotification","args":{"fd":218},"dur":45,"tdur":43,"tts":50797},
{"pid":5115,"tid":2,"ts":55786934747,"ph":"X","cat":"ipc,toplevel","name":"ChannelReader::DispatchInpu
@birjj
birjj / chokidar_#552.js
Created November 11, 2016 13:07
chokidar/#552
var watchPath = "test/";
var found = (function(){
var hist = {},
done = false,
timer;
return function found(path){
if (done) {
console.log("Already checked. Please rerun.");
return;
@birjj
birjj / chokidar_#552-1.log
Last active November 11, 2016 15:05
chokidar/#552
Native: rename bin
Raw: rename - bin - { watchedPath: 'test/' }
Native: rename bin
Raw: rename - bin - { watchedPath: 'test/' }
Native: rename lib
Raw: rename - lib - { watchedPath: 'test/' }
Native: rename lib
Raw: rename - lib - { watchedPath: 'test/' }
Native: rename node_modules
Raw: rename - node_modules - { watchedPath: 'test/' }
const readdirp = require('readdirp');
let filtered = {};
let added = {};
function filter(entry){
filtered[entry.fullPath] = true;
return true;
}
readdirp({
class CNF:
def __init__(self, filename):
self.file = open(filename, "w")
self.clauses = []
self.variables = 0
def add(self, clause):
# takes a list of variables, adds it as a clause to our output
#print("Adding clause", clause)
self.clauses.append(" ".join([str(x) for x in clause])+" 0\n")
@birjj
birjj / colored.png
Last active February 8, 2018 21:43
Simple Icons contribution guidelines images
colored.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
INSERT INTO Tournaments (name, prize, date) VALUES
('Intel Extreme Masters XII - World Championship', 250000, '2018-02-27'),
('StarLadder & i-League StarSeries Season 4', 130000, '2018-02-17'),
('ELEAGUE Major: Boston 2018', 500000, '2018-01-12'),
('Esports Championship Series Season 4 - Finals', 250000, '2017-12-15'),
('ESL Pro League Season 6 - Finals', 225000, '2017-12-05');
INSERT INTO Teams (name, country) VALUES
('Astralis', 'DK'),
('mousesports', 'EU'),