Skip to content

Instantly share code, notes, and snippets.

View Teino1978-Corp's full-sized avatar

Teino Boswell Teino1978-Corp

  • Ocho Rios, Jamaica
View GitHub Profile
@Teino1978-Corp
Teino1978-Corp / pre-commit
Created January 29, 2016 08:10
Pre-commit hook to detect if any files contain dd() - https://www.drupal.org/node/819900
#!/usr/bin/php
<?php
$files = shell_exec('git diff-index --name-only --cached --diff-filter=ACMR HEAD | grep "\.php$"');
$files = explode("\n", trim($files));
$exitCode = 0;
foreach ($files as $file) {
if (empty($file)) {
continue;
}
$lines = file($file);
//: Playground
import UIKit
// we can use semicolons
let cat = "🐱"; print(cat)
// integer
print(UInt8.min)
print(UInt8.max)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Find in linked list</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
#! /bin/sh
#
# Install the latest version of calibre for OS X
# Replaces any existing version in /Applications or ~/Applications
#
# Copyright (C) 2013 Faraz Yashar
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
@Teino1978-Corp
Teino1978-Corp / README.md
Created January 22, 2016 07:49
How to securely set rails secret key when you deploy to Heroku.

Stop Versioning Rails Secret Tokens

After reading Code Climate's Rails' Insecure Defaults I realized I was guilty of breaking rule 3. Versioned Secret Tokens. Here's how I fixed it.

Use dotenv in development and test environments:

# Gemfile
gem 'dotenv-rails', groups: [:development, :test]
@Teino1978-Corp
Teino1978-Corp / README.md
Created January 22, 2016 07:48 — forked from cjolly/README.md
How to securely set rails secret key when you deploy to Heroku.

Stop Versioning Rails Secret Tokens

After reading Code Climate's Rails' Insecure Defaults I realized I was guilty of breaking rule 3. Versioned Secret Tokens. Here's how I fixed it.

Use dotenv in development and test environments:

# Gemfile
gem 'dotenv-rails', groups: [:development, :test]

tl;dr

  1. Don't run as root.
  2. For sessions, set httpOnly (and secure to true if running over SSL) when setting cookies.
  3. Use the Helmet for secure headers: https://github.com/evilpacket/helmet
  4. Enable csrf for preventing Cross-Site Request Forgery: http://expressjs.com/api.html#csrf
  5. Don't use the deprecated bodyParser() and only use multipart explicitly. To avoid multiparts vulnerability to 'temp file' bloat, use the defer property and pipe() the multipart upload stream to the intended destination.
var source = Backbone.Radio.channel('source');
var proxy = Backbone.Radio.channel('proxy');
// 1 to 1 mapping
proxy.proxyEvents(source, {
'source:foo': 'proxy:foo'
});
proxy.on('proxy:foo', console.log);
source.trigger('source:foo', 1); // triggers proxy:foo on proxy, prints 1
#foo:checked::before,
input[type="checkbox"] {
position:absolute;
clip: rect(0,0,0,0);
clip: rect(0 0 0 0);
}
#foo:checked,
input[type="checkbox"] + label::before {
content: url('checkbox.png');
@Teino1978-Corp
Teino1978-Corp / InsertFormWizard.cs
Created January 9, 2016 07:01
Updated form selector to allow selection of existing forms
using System;
using System.Text;
using Sitecore;
using Sitecore.Data.Items;
using Sitecore.Globalization;
using Sitecore.Web.UI.HtmlControls;
using Sitecore.Web.UI.Sheer;
namespace Sitecore.Custom.WFFM.UI
{