View horizontal-infinite-carousel.html
View routes.rb
admin_constraint = lambda do |request|
request.env['warden'].authenticate? and not request.env['warden'].user.nil?
end
constraints admin_constraint do
mount Logster::Web, at: "/logs"
end
View recursive_test.rb
@max_count = 5
def recursive_test(p1)
begin
if @max_count > 1
raise "test"
else
@max_count + p1
end
rescue
View create_snap_shots.rb
class CreateSnapShots < ActiveRecord::Migration[5.0]
def change
create_table :snap_shots do |t|
t.integer :user_id
t.string :table_name
t.text :table_data , limit: 4294967295
t.integer :table_id
t.integer :snapshot_id
t.timestamps
View gmail_sender.rb
require 'pony'
=begin
Use gmail's smtp server to send email:
1. Turn on 2-Step Verification (see https://myaccount.google.com/security)
2. Sign in using App Passwords (see https://support.google.com/accounts/answer/185833?hl=en)
or alternative method:
1. Turn off 2-Step Verification (see https://myaccount.google.com/security)
2. Allow less secure apps: https://myaccount.google.com/u/0/lesssecureapps?pli=1
View app.py
from flask import Flask, send_from_directory
app = Flask(__name__)
@app.route('/base/<path:filename>')
def base_static(filename):
return send_from_directory(app.root_path + '/../static/', filename)
View phantomjs-netsniff.js
if (!Date.prototype.toISOString) {
Date.prototype.toISOString = function () {
function pad(n) { return n < 10 ? '0' + n : n; }
function ms(n) { return n < 10 ? '00'+ n : n < 100 ? '0' + n : n }
return this.getFullYear() + '-' +
pad(this.getMonth() + 1) + '-' +
pad(this.getDate()) + 'T' +
pad(this.getHours()) + ':' +
pad(this.getMinutes()) + ':' +
pad(this.getSeconds()) + '.' +
View get_title_and_url.applescript
# Keep in mind that when asking for a `return` after another, only the first one will be output.
# This example is meant as a simple starting point, to show how to get the information in the simplest available way.
# Google Chrome
tell application "Google Chrome" to return URL of active tab of front window
tell application "Google Chrome" to return title of active tab of front window
# Google Chrome Canary
tell application "Google Chrome Canary" to return URL of active tab of front window
tell application "Google Chrome Canary" to return title of active tab of front window
# Chromium
View nginx-default-conf
vim `/etc/nginx/sites-available/default`
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_name erlang.us;
View kvs.erl
-module(kvs).
-behaviour(gen_server).
%% API
-export([start_link/0, store/2, lookup/1]).
%% gen_server callbacks
-export([init/1,
handle_call/3,
handle_cast/2,