Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<title>modal</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.0/css/bootstrap.min.css" />
</head>
<body></body>
@bluesmoon
bluesmoon / loader.html
Last active January 3, 2024 20:40
A CSP compliant non-blocking script loader
<script id="nb-loader-script">
(function(url) {
// document.currentScript works on most browsers, but not all
var where = document.currentScript || document.getElementById("nb-loader-script"),
promoted = false,
LOADER_TIMEOUT = 3000,
IDPREFIX = "__nb-script";
// function to promote a preload link node to an async script node
@josete89
josete89 / dataTransform.js
Created November 14, 2017 20:00
Data mapping with sanctuary
var data = {"id":1,"orderName":"Order from spain","teamName":"Portland penguins","orderType":"lock","discount":5,"contactName":"John doe","contactPhonePrefix":"+32","contactPhoneNumber":"3423232","contactEmail":"jhon.doe@mycompany.com","contactAddress":"830 Southwest","dealerId":"123","dealerNote":"Lorem ipsum","createdAt":"2017-11-13T16:40:12.000Z","updatedAt":"2017-11-13T16:40:12.000Z","products":[{"id":5,"externalId":"C77124","createdAt":"2017-11-13T16:40:12.000Z","updatedAt":"2017-11-13T16:40:12.000Z","OrderProduct":{"createdAt":"2017-11-13T16:40:12.000Z","updatedAt":"2017-11-13T16:40:12.000Z","orderId":1,"productId":5},"selectedSizes":[{"id":1,"technicalSize":520,"quantity":5,"createdAt":"2017-11-13T16:40:12.000Z","updatedAt":"2017-11-13T16:40:12.000Z","ProductSelectedSize":{"createdAt":"2017-11-13T16:40:12.000Z","updatedAt":"2017-11-13T16:40:12.000Z","productId":5,"selectedSizeId":1}}]}]}
var transformation = {"id":"id","order_name":"orderName","team_name":"teamName","order_type":"orderType","discount":
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active June 25, 2024 12:19
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@zo0m
zo0m / Gruntfule.js
Last active January 14, 2018 18:27
Gruntfile for sharing: start Grunt look , raw version --- TODO: remove reduntant tasks
module.exports = function(grunt) {
grunt.initConfig({
sync: {
main: {
files: [{
cwd : 'app',
src: [
'**', /* Include everything */
],
dest: '/Users/admin/Documents/Appcelerator_Studio_Workspace/gevar/app'
@cletusw
cletusw / .eslintrc
Last active February 29, 2024 20:24
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@amichaelgrant
amichaelgrant / gist:90d99d7d5d48bf8fd209
Created November 11, 2014 17:41
failed (104: Connection reset by peer) while reading response header from upstream, client:
failed (104: Connection reset by peer) while reading response header from upstream, client:
If you are getting the above error in nginx logs running in from of upstream servers you may consider doing this as it worked for me:
check the ulimit on the machines and ensure it is high enough to handle the load coming in. 'ulimit' on linux, I am told determines the maximum number of open files the kernel can handle.
The way I did that?
modifying limits: for open files:
--------------------------------
add or change this line in /etc/systcl.conf
fs.file-max = <limit-number>
@scottjehl
scottjehl / noncritcss.md
Last active August 12, 2023 16:57
Comparing two ways to load non-critical CSS

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

@cmsx
cmsx / VideoThumb.php
Last active February 27, 2024 16:38
Класс для получения превью и информации о ролике RuTube, Vimeo, Youtube по ссылке.
<?php
/**
* Использование:
* $v = new VideoThumb($link);
* $v->getVideo(); //Ссылка на видео
* $v->getTitle(); //Название ролика
* $v->fetchImage($path) //Скачать самое большое превью ролика
*
* Прогнать тест:
@jdkanani
jdkanani / notepad.html
Last active June 16, 2024 13:44 — forked from jakeonrails/Ruby Notepad Bookmarklet
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`