Skip to content

Instantly share code, notes, and snippets.

@sentientwaffle
sentientwaffle / open-in-new-tab.js
Created November 18, 2012 17:20
Open link in new tab
// Source: http://jsfiddle.net/3ZmvS/5/
function openNewTab(url) {
var a = document.createElement("a")
, ev = document.createEvent("MouseEvents")
a.href = url
ev.initMouseEvent( "click", true, true, window
, 0, 0, 0, 0, 0, true, false
, false, false, 0, null )
@border
border / gocookies.go
Created December 7, 2013 07:27
go cookiejar demo
package main
import (
"io/ioutil"
"log"
"net/http"
"net/http/cookiejar"
)
var gCurCookies []*http.Cookie
@dominikzogg
dominikzogg / EntityManagerDecorator.php
Created October 29, 2019 18:58
EntityManager within Swoole
<?php
declare(strict_types=1);
namespace App\Orm;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\Decorator\EntityManagerDecorator as DoctrineEntityManagerDecorator;
use Doctrine\ORM\EntityManager;
@Jaesin
Jaesin / delete_content_entities.d8.php
Created June 22, 2015 07:14
Delete all content entities in Drupal 8.
<?php
// Delete all nodes.
entity_delete_multiple('node', \Drupal::entityQuery('node')->execute());
// Delete all files.
entity_delete_multiple('file', \Drupal::entityQuery('file')->execute());
// Delete all taxonomy terms.
entity_delete_multiple('taxonomy_term', \Drupal::entityQuery('taxonomy_term')->execute());
@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@stormpython
stormpython / how_to_set_up_ssh_keys.md
Last active August 10, 2023 03:33
Setting up ssh keys for remote server access

How to Set up SSH Keys

Create the RSA Key Pair

ssh-keygen -t rsa

Store the Keys and Passphrase

Once you have entered the Gen Key command, you will get a few more questions:

@ve3
ve3 / Encryption.js
Last active August 10, 2023 10:51
Encrypt and decrypt between programming languages (PHP & JavaScript). (Newer version here https://gist.github.com/ve3/b16b2dfdceb0e4e24ecd9b9078042197 )
/**
* Encryption class for encrypt/decrypt that works between programming languages.
*
* @author Vee Winch.
* @link https://stackoverflow.com/questions/41222162/encrypt-in-php-openssl-and-decrypt-in-javascript-cryptojs Reference.
* @link https://github.com/brix/crypto-js/releases crypto-js.js can be download from here.
*/
class Encryption {
@jirisolc
jirisolc / https_fopen_without_cert_check.php
Last active October 14, 2023 18:44
PHP fopen() to https:// without cert check
<?php
$context = stream_context_create(
array (
'ssl' = > array (
'verify_peer' => false,
'verify_peer_name' => false
)
)
);
@craigbeck
craigbeck / introspection-query.graphql
Created April 6, 2016 20:20
Introspection query for GraphQL
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
@mbejda
mbejda / Industries.csv
Last active February 28, 2024 03:12
Compiled list of industries.
Industry
Accounting
Airlines/Aviation
Alternative Dispute Resolution
Alternative Medicine
Animation
Apparel/Fashion
Architecture/Planning
Arts/Crafts
Automotive