Skip to content

Instantly share code, notes, and snippets.

View ducin's full-sized avatar
🛠️
creatin' some stuff

Tomasz Ducin ducin

🛠️
creatin' some stuff
View GitHub Profile
@ducin
ducin / reveal.js
Created September 19, 2016 14:27
REVEAL.JS bonus
Reveal.configure({
keyboard: {
40: 'next',
38: 'prev'
}
});
@uranusjr
uranusjr / install_ensurepip.py
Created August 22, 2014 02:44
Script to install ensurepip to Python. “Fix” the Ubuntu 14.04 / Debian Sid bug. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732703
import os
import sys
import io
import tarfile
import urllib.request
ARCHIVE_URL = 'http://d.pr/f/YqS5+'
@freeeve
freeeve / neoexample.sh
Created November 13, 2012 20:54
cypher shell script
Wess-MacBook-Pro:bin wfreeman$ cat test.cypher
create (m {name:"m"});
create (n {name:"n"});
Wess-MacBook-Pro:bin wfreeman$ ./neo4j-shell -c < test.cypher
Welcome to the Neo4j Shell! Enter 'help' for a list of commands
NOTE: Remote Neo4j graph database service 'shell' at port 1337
neo4j-sh (?)$ create (m {name:"m"});
+-------------------+

The scope of a variable is the region of the program in which you can directly access the variable:

if (true) {
  let x = 123;
}

Here, the scope of x is the then-block of this if-then-else statement.

@ducin
ducin / console-load-js-script.js
Last active February 18, 2021 06:14
load js script from blank page browser (execute following code in the browser console)
(function(root){
root.getScript = function(url) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
document.head.appendChild(script);
}
}(window));
getScript('http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.js');
@jonnyreeves
jonnyreeves / testrunner.html
Created June 2, 2012 13:32
Unit Testing Promises with Sinon.js
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" />
<!-- when.js Promises implementation -->
<script src="https://raw.github.com/cujojs/when/master/when.js"></script>
<!-- Unit testing and mocking framework -->
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script>
@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example
@threepointone
threepointone / for-snook.md
Last active August 26, 2023 15:43
For Snook

https://twitter.com/snookca/status/1073299331262889984?s=21

‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css-in-js (cij) is selectors.

@ryanflorence
ryanflorence / universal-module.js
Created September 6, 2011 18:10
Universal JavaScript Module, supports AMD (RequireJS), Node.js, and the browser.
(function (name, definition){
if (typeof define === 'function'){ // AMD
define(definition);
} else if (typeof module !== 'undefined' && module.exports) { // Node.js
module.exports = definition();
} else { // Browser
var theModule = definition(), global = this, old = global[name];
theModule.noConflict = function () {
global[name] = old;
return theModule;
@rosario
rosario / composing-software.md
Created January 17, 2018 16:13 — forked from Geoff-Ford/composing-software.md
Eric Elliott's Composing Software Series