This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Gunicorn config file. | |
by HacKan (https://hackan.net) | |
Find it at: https://gist.github.com/HacKanCuBa/275bfca09d614ee9370727f5f40dab9e | |
Based on: https://gist.github.com/KodeKracker/6bc6a3a35dcfbc36e2b7 | |
Changelog | |
========= | |
See revisions to access other versions of this file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppOS.Component.Recaptcha3 extends AppOS.Component | |
name: "recaptcha" | |
API_URL: "https://www.google.com/recaptcha/api.js?onload=%callback&render=explicit" | |
API_KEY: "MY_PUBLIC_SITEKEY" | |
init: -> | |
@pending = [] | |
@apiState = "unloaded" | |
# init event |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# === EDITOR === | |
Pry.editor = 'vi' | |
# === PROMPT === | |
Pry.prompt = [ ->(obj, nest_level, _) { "✎ " }, ->(obj, nest_level, _) { "#{' ' * nest_level} " } ] | |
# === COLORS === | |
unless ENV['PRY_BW'] | |
Pry.color = true | |
Pry.config.theme = "railscasts" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This server demo does a socket hijack in Rack and then saves the socket to a global variable | |
# to prevent it from being GCed when the Puma thread ends. It will then write "BEEP" to each | |
# socket every ten seconds to prevent the connection timing out. During testing, it easily | |
# handled up to 65523 connections, after which it ran into the `ulimit` for open file descriptors. | |
# The bit with the waiting area is there because a normal `Set` is not thread safe and it would | |
# drop socket due to race conditions. The `Queue` is thread safe and will make sure all sockets | |
# are preserved. | |
# run with `rackup -q -p 8000 -o 0.0.0.0 c10k.ru` | |
# testing: install `ab` and then run `ab -c 20000 -n 20000 <ip adress of server>:8000/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
generator { | |
lines => ['2011-04-19T03:44:01.103Z testlog1', | |
'2011-04-19T03:44:02.035Z testlog2', | |
'2011-04-19T03:44:03.654Z testlog3', | |
'2011-04-19T03:44:03.654Z testlog3'] | |
count => 1 | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'colorize' | |
end | |
class MatcherInterface | |
def initialize(some_object) | |
@some_object = some_object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list pid, execution time, and query text for running queries | |
def pg_ps | |
now = Time.now | |
ActiveRecord::Base.connection.execute("SELECT pid, query, query_start FROM pg_stat_activity WHERE state='active'").to_a.each do |q| | |
printf "%8d %10.2f %s\n", q['pid'], now - DateTime.parse(q['query_start']), q['query'] | |
end | |
nil | |
end | |
# cancel the current query for the given process |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hoverTime = 400 | |
const fetchers = {} | |
const doc = document.implementation.createHTMLDocument('prefetch') | |
function fetchPage (url, success) { | |
const xhr = new XMLHttpRequest() | |
xhr.open('GET', url) | |
xhr.setRequestHeader('VND.PREFETCH', 'true') | |
xhr.setRequestHeader('Accept', 'text/html') | |
xhr.onreadystatechange = () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'pg' | |
gem 'activerecord', '5.2.0' | |
gem 'benchmark-ips' | |
end | |
require 'active_record' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let re; | |
//this looks for the string between the slashes. it'll match hello but not HeLlo. | |
re = /hello/; | |
//the lower case i means be case insensitive. this will match HellO. | |
re = /hello/i; | |
// explaination for common search characters |