Skip to content

Instantly share code, notes, and snippets.

@waleedsamy
waleedsamy / httpsclient.js
Last active March 22, 2018 06:47
express js https server and client with self signed certificate
const request = require('request'),
fs = require('fs'),
path = require('path'),
ca = fs.readFileSync(path.join(__dirname, 'root-ca.crt'));
const options = {
url: 'https://127.0.0.1:3443/', // any @alt_names will work
agentOptions: {
ca: ca
}
@jo
jo / js-crypto-libraries.md
Last active May 22, 2024 13:16
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

List some crypto libraries for JavaScript out there. Might be a bit out dated. Scroll to the bottom.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

@cmourizard
cmourizard / SugarCRM Subpanel lazy loadding.rst
Last active December 25, 2015 02:59
SugarCRM Subpanel lazy loadding
<?php
class FieldChangeHook
{
protected static $fetchedRow = array();
/**
* Called as before_save logic hook to grab the fetched_row values
*/
public function saveFetchedRow($bean, $event, $arguments)
@jmertic
jmertic / gist:5986008
Created July 12, 2013 17:01
Example of adding a field to a layout, that can work thru a post_install script in a loadable module ( copied from http://codesearch.epicom.com/displayFile.php?filename=./EpicomsQuickBooksIntegration/scripts/pre_install.php&q=ParserFactory )
<?php
function pre_install()
{
global $current_user;
require_once('include/utils.php');
require_once('include/utils/file_utils.php');
require_once('config.php');
require_once('include/MVC/Controller/SugarController.php');
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 30, 2024 08:12
A badass list of frontend development resources I collected over time.
@bwbaugh
bwbaugh / classify.py
Created April 25, 2013 21:03
Detecting a Specific Watermark in a Photo with Python Get example training and testing images here: <http://bwbaugh.com/stack-overflow/16222178_watermark.tar> Stack Overflow question: <http://stackoverflow.com/questions/16222178/detecting-a-specific-watermark-in-a-photo-with-python-without-scipy>
# Copyright (C) 2013 Wesley Baugh
"""Tools for text classification.
Extracted from the [infer](https://github.com/bwbaugh/infer) library.
"""
from __future__ import division
import math
from collections import defaultdict, namedtuple, Counter
from fractions import Fraction