Skip to content

Instantly share code, notes, and snippets.

$rawData = file_get_contents("php://input");
\Log::emergency('User payload: ', ['headers' => $this->request->headers, 'user_input' => $rawData]);
@mp3063
mp3063 / index_page_test.rb
Last active September 26, 2018 21:57
Testing rails index page #rails #test
test "should get home" do
get pages_home_url
assert_response :success
end
@mp3063
mp3063 / rake_task_example.rake
Last active September 26, 2018 22:00
Rake task example #rails #rake
require_relative '../../app/matko/nokogiri_scrape.rb'
namespace :shipment do
desc('Check if there any changes in shipments')
task schedule: :environment do
nok = NokogiriScrape.new
nok.check_all_shipments
end
end
@mp3063
mp3063 / change_encoding.rb
Last active September 26, 2018 22:02
Change encoding of .dat file and split by lines #rails #encoding
open(url, "r:ISO-8859-1:UTF-8").each_line
@mp3063
mp3063 / shortenTextWithMoreLessLinks.js
Created March 16, 2018 12:16
Toggle text more than 100 characters hide and show more link btn, on click show whole text adn less btn
@mp3063
mp3063 / hide_iframe.css
Created February 23, 2018 14:09
Hide google translate iframe
.goog-te-banner-frame.skiptranslate {
display: none !important;
}
body {
top: 0px !important;
}
@mp3063
mp3063 / cept.bat
Created May 20, 2017 12:33
Make this file and than run cept bootstrap to scaffold codeception folders for tests on windows.
@echo off
@setlocal
set CODECEPT_PATH=vendor/bin/
"%CODECEPT_PATH%codecept.bat" %*
@endlocal
@mp3063
mp3063 / CaseInsensitiveContains.js
Last active May 9, 2017 14:50
Work around to get case insensitive :contains. Example search element like on packagist. Show searched elements and hide others.
$(".search-song").keyup(function () {
// work around to get case insensitive :contains
$.expr[":"].contains = $.expr.createPseudo(function (arg) {
return function (elem) {
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});
let searchSongValue = $(this).val();
let songField = $(".song");
let findSong = $(".song:contains('" + searchSongValue + "')").show();
@mp3063
mp3063 / jquery_contains_fix_caseinsensitive.js
Created March 21, 2017 21:44
Work around to get case insensitive search with jquery :contains method
$.expr[":"].contains = $.expr.createPseudo(function(arg) {
return function( elem ) {
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});