This file contains 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
def luhn(code) | |
(code | |
.chars # Break into individual digits | |
.map(&:to_i) # map each character by calling #to_i on it | |
.reverse # Start from the end | |
.map.with_index { |x, i| i.odd? ? x * 2 : x } # Double every other digit | |
.map { |x| x > 9 ? x - 9 : x } # If > 9, subtract 9 (same as adding the digits) | |
.inject(0, :+) % 10).zero? # Check if multiple of 10 | |
end |
This file contains 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
#!/usr/bin/env puma | |
# The directory to operate out of. | |
# | |
# The default is the current directory. | |
# | |
# directory '/u/apps/lolcat' | |
# Use an object or block as the rack application. This allows the | |
# config file to be the application itself. |
This file contains 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
#!/home/RUBYUSER/.rvm/rubies/ruby-2.3.0/bin/ruby | |
require 'rubygems' | |
require 'rb-inotify' | |
require 'slack-notifier' | |
watcher = INotify::Notifier.new | |
notifier = Slack::Notifier.new "https://hooks.slack.com/services/SLACKWEBHOOKURL" | |
notifier.channel = '#CHANNEL_NAME' |
This file contains 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
label | |
input#test-checkbox type="checkbox" | |
|Test checkbox | |
table#test-table | |
javascript: | |
$(document).ready(function() { | |
var table = $("#test-table").dataTable( { | |
"ajaxSource": '#{test_datatable_path}', |
This file contains 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
I restored a backup from production locally and tried to just move things and hit admin/modules or to run registry_rebuild() but it didn't stop fatal errors from being thrown. This makes sense to me since some modules may use includes or whatever in their hook_init(), or you may have a menu router path set that depends on a module or include that Drupal can't find on bootstrap. Ultimately, this is what I did (your paths may be different): | |
Step 1: Replace sites/all/modules with sites/all/modules/contrib | |
UPDATE system SET filename = REPLACE(filename, 'sites/all/modules', 'sites/all/modules/contrib'); | |
UPDATE registry SET filename = REPLACE(filename, 'sites/all/modules', 'sites/all/modules/contrib'); | |
UPDATE registry_file SET filename = REPLACE(filename, 'sites/all/modules', 'sites/all/modules/contrib'); | |
Step 2: Replace sites/all/modules/contrib with sites/all/modules/custom for custom namespaced modules | |
UPDATE system SET filename = REPLACE(filename, 'sites/all/modules/contrib', 'sites/all/modules/custom') WHER |
This file contains 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 'rubygems' | |
require "net/http" | |
require "net/https" | |
require 'nokogiri' | |
XML = Nokogiri::HTML open "sitemap.xml" | |
links = XML.css "loc" | |
links.each do |link| | |
uri = URI link.text |
This file contains 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
Exorcizo te, immundissime spiritus, omnis incursio adversarii, omne phantasma, omnis legio, in nomine Domini nostri Jesu Christi eradicare, et effugare ab hoc plasmate Dei. Ipse tibi imperat, qui te de supernis caelorum in inferiora terrae demergi praecepit. Ipse tibi imperat, qui mari, ventis, et tempestatibus impersvit. Audi ergo, et time, satana, inimice fidei, hostis generis humani, mortis adductor, vitae raptor, justitiae declinator, malorum radix, fomes vitiorum, seductor hominum, proditor gentium, incitator invidiae, origo avaritiae, causa discordiae, excitator dolorum: quid stas, et resistis, cum scias. Christum Dominum vias tuas perdere? Illum metue, qui in Isaac immolatus est, in joseph venumdatus, in sgno occisus, in homine cruci- fixus, deinde inferni triumphator fuit. Sequentes cruces fiant in fronte obsessi. Recede ergo in nomine Patris et Filii, et Spiritus Sancti: da locum Spiritui Sancto, per hoc signum sanctae Cruci Jesu Christi Domini nostri: Qui cum Patre et eodem Spiritu Sancto vivit et r |
This file contains 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
<?php | |
header('Content-Type: text/html; charset=UTF-8'); | |
define('DRUPAL_ROOT', getcwd()); | |
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; | |
require_once DRUPAL_ROOT . '/includes/common.inc'; | |
require_once DRUPAL_ROOT . '/includes/module.inc'; | |
require_once DRUPAL_ROOT . '/includes/unicode.inc'; | |
require_once DRUPAL_ROOT . '/includes/file.inc'; | |
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); |
This file contains 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
<?php | |
header('Content-Type: text/html; charset=UTF-8'); | |
define('DRUPAL_ROOT', getcwd()); | |
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; | |
require_once DRUPAL_ROOT . '/includes/common.inc'; | |
require_once DRUPAL_ROOT . '/includes/module.inc'; | |
require_once DRUPAL_ROOT . '/includes/unicode.inc'; | |
require_once DRUPAL_ROOT . '/includes/file.inc'; |
This file contains 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
<body oncontextmenu="return false"> | |
... | |
<script> | |
document.onmousedown=disableclick; | |
function disableclick ( event ) { | |
if ( event.button == 2 ) { return false; } | |
}; | |
</script> |
NewerOlder