Skip to content

Instantly share code, notes, and snippets.

View skyrpex's full-sized avatar
👋

Cristian Pallarés skyrpex

👋
View GitHub Profile
@skyrpex
skyrpex / esm-package.md
Created April 20, 2022 11:56 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@skyrpex
skyrpex / salt-hash-password.js
Created March 30, 2022 15:56 — forked from branneman/salt-hash-password.js
Node.js: Create salted hashed password
const crypto = require('crypto')
const { promisify } = require('util')
const pbkdf2 = promisify(crypto.pbkdf2)
module.exports = { createHashPasswordFn, isPasswordCorrect }
/**
* @typedef {Object} HashPassword
* @property {String} hash
* @property {String} salt
boost::optional<int> f1(int a);
boost::optional<int> f2(int b, int c);
boost::optional<int> f3(int d);
boost::optional<int> f4(int e);
boost::optional<int> result = chain(
[] { return f1(3); },
[] { return f1(4); }
).then(
[] (int b, int c) { return f2(b, c); }
<apex:page standardStylesheets="false" showHeader="false" sidebar="false" recordSetVar="macros" docType="html-5.0"
standardController="Macro__c" extensions="ApplyMacroControllerExtension" title="Select Macro" >
<apex:includeScript value=""/>
<apex:includeScript value="/support/console/30.0/integration.js"/>
<apex:includeScript value="/soap/ajax/30.0/connection.js"/>
<apex:includeScript value="/support/api/30.0/interaction.js"/>
<apex:includeScript value="/canvas/sdk/js/30.0/publisher.js"/>
<apex:stylesheet value="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
@skyrpex
skyrpex / entityx_tx2.cc
Created May 17, 2016 10:25 — forked from alecthomas/entityx_tx2.cc
Parallel EntityX prototype
#include <utility>
#include <thread>
#include <limits>
#include <algorithm>
#include <cassert>
#include <vector>
#include <cstdint>
#include <iostream>
#include <mutex>
#include <future>
@skyrpex
skyrpex / .gitconfig
Created April 15, 2016 07:42 — forked from berngp/.gitconfig
dot.gitconfig
[user]
name = Your Name
email = your.name@mail.com
[color]
ui = true
[core]
excludesfile = ~/.gitignore_global
editor = /usr/local/bin/mvim -f
@skyrpex
skyrpex / main.cpp
Last active October 17, 2015 10:28
Experimental ECS C++ implementation using vectors, tuples and optionals
#include <iostream>
#include <tuple>
#include <vector>
#include <experimental/optional>
template<class ...Cs>
class Container
{
public:
template<class T> using Optional = std::experimental::optional<T>;
@skyrpex
skyrpex / ioc.cpp
Last active October 13, 2015 14:30
Inversion Of Control in C++
#include <iostream>
#include <typeinfo>
#include <typeindex>
#include <functional>
#include <memory>
#include <unordered_map>
class AbstractTest
{
public:
@skyrpex
skyrpex / preventDefault.babel.js
Last active October 6, 2015 09:51
Vue Directives: Prevent Default
const eventNames = {
BUTTON: 'click',
A: 'click',
FORM: 'submit',
};
export default {
bind() {
const eventName = eventNames[this.el.nodeName];
if (!eventName) {
qApp->setStyle(QStyleFactory::create("Fusion"));
QPalette darkPalette;
darkPalette.setColor(QPalette::Window, QColor(53,53,53));
darkPalette.setColor(QPalette::WindowText, Qt::white);
darkPalette.setColor(QPalette::Base, QColor(25,25,25));
darkPalette.setColor(QPalette::AlternateBase, QColor(53,53,53));
darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
darkPalette.setColor(QPalette::Text, Qt::white);