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 | |
/** | |
* Shortcut to doing regex without needing to worry about $matches | |
* @param type $pattern | |
* @param type $search | |
* @param type $group | |
*/ | |
function preg_search($pattern, $search, $group=1) { | |
if (preg_match($pattern, $search, $matches)) { | |
if (isset($matches[$group])) { |
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
private String rotateString(String s, int distance) { | |
String out = ""; | |
for (int i=0; i<s.length(); i++) { | |
out += s.charAt((i + distance) % s.length()); | |
} | |
return out; | |
} |
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
SELECT u.lastname, u.firstname, u.idnumber, | |
( | |
SELECT COUNT(*) | |
FROM prefix_quiz_attempts attempts | |
JOIN prefix_quiz quiz | |
ON attempts.quiz=quiz.id | |
JOIN prefix_course_modules cm | |
ON cm.instance=quiz.id | |
WHERE | |
attempts.userid=u.id |
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
del /S *.flac |
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
git archive --format=zip --prefix=foldername/ > zipfile.zip |
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
function base64_decode_maybe($str) { | |
if (base64_encode(base64_decode($str, true)) == $str) { | |
return base64_decode($str); | |
} | |
return $str; | |
} |
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
var edit = ace.edit('editorDiv'); | |
edit.renderer.setShowGutter(false); |
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
import java.lang.reflect.Field; | |
import java.util.*; | |
import java.io.*; | |
import static org.junit.Assert.*; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.junit.runners.Parameterized; | |
import org.junit.runners.Parameterized.Parameters; |
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
docker stop $(docker ps -a -q) | |
docker rm $(docker ps -a -q) |
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 | |
function web_safe_colors() { | |
$ray = array(); | |
$steps = array( | |
'00', | |
'33', | |
'66', | |
'99', | |
'cc', | |
'ff' ); |
OlderNewer