Skip to content

Instantly share code, notes, and snippets.

View cancerberoSgx's full-sized avatar

Sebastián Gurin cancerberoSgx

  • home
  • Montevideo, Uruguay
View GitHub Profile
@cancerberoSgx
cancerberoSgx / promisified-hyperquest.js
Created May 10, 2018 05:44 — forked from nikcorg/promisified-hyperquest.js
Promisified Hyperquest -- A quick exercise wrapping Hyperquest in a Promise for an easy thenable API.
var concat = require("concat-stream");
var hyperquest = require("hyperquest");
var stream = require("stream");
// Wait for the request to finish or fail
function promisify(req) {
return new Promise(function (resolve, reject) {
req.on("error", reject).pipe(concat({ encoding: "string" }, resolve));
});
@cancerberoSgx
cancerberoSgx / rmnodemodules.sh
Last active January 2, 2024 21:30
remove node_modules and package-lock.json recursively
find . -name "node_modules" -exec rm -rf '{}' +; find . -name "package-lock.json" -exec rm -rf '{}' +;

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

# Usage examle:
# $ time sh testing/repeatUntilFails.sh "npm run test-nobuild"
counter=0
while true; do
eval $1
if [[ "$?" -ne 0 ]]; then
echo
echo "*******"
echo " * FAILURE at loop #"$counter
@cancerberoSgx
cancerberoSgx / watch and exec.md
Last active April 25, 2018 06:32
watch and exec

Using unix command watch for detecting a change in file and executing command:

while true ; do  watch -g -d "cat src/index.ts" && yarn run doc-docco ; done

More refined, this time executes the command first:

CMD="yarn run doc-docco"; eval $CMD ; while true ; do watch -g -d "cat src/index.ts" && eval $CMD ; done
@cancerberoSgx
cancerberoSgx / lucy_build_and_run_example.sh
Last active October 30, 2017 02:52
how to build [apache lucy](https://lucy.apache.org/), install libraries and includes and then compile and run one of its samples (linux)
# The following shell script demonstrate how to build apache lucy https://lucy.apache.org/
# compile one of its sample and run it in a linux system.
# IMPORTANT: change variables FOLDER and PREFIX according to your system
FOLDER=/home/sg/test
PREFIX=/usr # where includes and libs will be installed in your system
mkdir -p $FOLDER
@cancerberoSgx
cancerberoSgx / istanbuljs-api-example-1.js
Last active September 6, 2017 09:08
istanbuljs example of programmatic instrumentation, and coverage report.
// In this example we are instrumenting JavaScript code string, executing it, and then generating a coverage report.
// instrument the code
var instrumenter = require('istanbul-lib-instrument').createInstrumenter({})
var instrumentedCode = instrumenter.instrumentSync('var a = 1; function f(){return 1}; f(); ', 'file1.js')
@cancerberoSgx
cancerberoSgx / gist:5163720
Created March 14, 2013 18:09
a simple UIBinder widget contains an html element with an id. AFTER calling initWidget(uiBinder.createAndBindUi(this)); document.getElementById() will return null. Only in an attach event listener I can retrieve the element by id. In the example I instantiate the widget directly from the entry point using RootPanel.get().add(new MainPanel())
package org.sgx.raphael4gwt.raphy.test.app;
public class MainPanel extends Composite {
private static MainPanelUiBinder uiBinder = GWT.create(MainPanelUiBinder.class);
interface MainPanelUiBinder extends UiBinder<Widget, MainPanel> {
}
public MainPanel() {
package org.sgx.raphael4gwt.raphael.widget;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
public class MyPaper extends Composite {
private static MyPaperUiBinder uiBinder = GWT.create(MyPaperUiBinder.class);
@cancerberoSgx
cancerberoSgx / gist:5000883
Last active December 14, 2015 00:39
gwt bug
/**
* <p>This is a severe GWT bug. System: Gwt 2.5 rc1 - linux - firefox</p>
*
* <p>The following entry point, executed in devel mode will give a
* Java StackOverflow exception:</p>
*
* <pre>
[ERROR] [gwttest3] - Stack overflow; to increase the stack
size, use the -Xss flag at startup (java -Xss1M ...)</pre>
*