Skip to content

Instantly share code, notes, and snippets.

Ryan Nutt RyanNutt

Block or report user

Report or block RyanNutt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@RyanNutt
RyanNutt / MonkeyHelloWorld.java
Last active May 10, 2018
Monkeys banging on a keyboard to solve Hello World - https://clsc.be/21
View MonkeyHelloWorld.java
public class MonkeyHelloWorld {
public static void main( String[] args ) {
String target = "Hello World";
String discovered = "";
long counted = 0l;
do {
counted++;
discovered = randomString();
@RyanNutt
RyanNutt / hide-cursor.css
Created Apr 28, 2018
Hide Ace editor cursor when editor is not active
View hide-cursor.css
.ace_hidden-cursors {
opacity:0
}
View inlineCSS.html
<div id='APblocks' style="font-family:monospace;" >
<bl style="border-width:1px;border-style:solid;border-color:black;border-radius:5px;font-family:monospace;padding-top:2px;padding-bottom:2px;padding-right:5px;padding-left:5px;background-color:white;display:inline-block;margin-top:1px;" >user &larr; <bl style="border-width:1px;border-style:solid;border-color:black;border-radius:5px;font-family:monospace;padding-top:2px;padding-bottom:2px;padding-right:5px;padding-left:5px;background-color:white;display:inline-block;margin-top:1px;" >INPUT</bl></bl><br>
<bl style="border-width:1px;border-style:solid;border-color:black;border-radius:5px;font-family:monospace;padding-top:2px;padding-bottom:2px;padding-right:5px;padding-left:5px;background-color:white;display:inline-block;margin-top:1px;" >rand &larr; <bl style="border-width:1px;border-style:solid;border-color:black;border-radius:5px;font-family:monospace;padding-top:2px;padding-bottom:2px;padding-right:5px;padding-left:5px;background-color:white;display:inline-
@RyanNutt
RyanNutt / Console.js
Last active Mar 8, 2018
Adds a copy checkbox to move multiple questions dialog in Canvas
View Console.js
// Adds the checkbox so you can copy instead of just move
$('.move_question_dialog_actions').append('<input type="checkbox" name="copy" id="copy_question" value="1" checked>');
// Check all the questions
$('li.list_question input').prop('checked', true);
@RyanNutt
RyanNutt / printAceEditorMode.js
Created Feb 28, 2018
Print the current mode from Ace Editor
View printAceEditorMode.js
console.info(editProblem.codeEdit.getSession().getMode().$id);
@RyanNutt
RyanNutt / restartWIA.bat
Created Feb 19, 2018
Batch file to restart Windows Acquisition (WIA) service - For a blog post on how to reset scanner https://www.nutt.net/cannot-communicate-with-the-scanner/
View restartWIA.bat
@net stop "Windows Image Acquisition (WIA)"
@net start "Windows Image Acquisition (WIA)"
@RyanNutt
RyanNutt / RandomNumbers.java
Created Feb 14, 2018
Generate an array of random, non repeating numbers
View RandomNumbers.java
private int[] randomNumbers( int size ) {
int[] out = new int[ size ];
ArrayList<Integer> allNumbers = new ArrayList<>();
for ( int i = 1; i < 11000; i++ ) {
allNumbers.add( i );
}
Collections.shuffle( allNumbers );
for ( int i = 0; i < size; i++ ) {
View StringJoin.java
List<String> words = new ArrayList<String>(Arrays.asList(new String[]{"howdy", "there", "neighbor"}));
String trimmed = String.join(", ", words);
System.out.println(trimmed);
@RyanNutt
RyanNutt / clearfix.php
Created Aug 20, 2017
WordPress code for adding a [clearfix] shortcode. Add this to your functions.php if you don't want to load a new plugin. See https://reliti.net/clearfix for more information.
View clearfix.php
<?php
add_shortcode('clearfix', 'clearfix_shortcode');
function clearfix_shortcode($args = []) {
$args_lc = array_map('strtolower', (array)$args);
if (array_search('left', $args_lc) !== false) {
$direction = 'left';
}
else if (array_search('right', $args_lc) !== false) {
@RyanNutt
RyanNutt / hide-title.css
Last active Jul 31, 2017
Sample code for post on how to hide WordPress titles - https://www.nutt.net/hide-post-titles-wordpress/
View hide-title.css
.postid-123 .page-title {
display: none;
}
You can’t perform that action at this time.