Skip to content

Instantly share code, notes, and snippets.

View rixth's full-sized avatar

Thomas Rix rixth

View GitHub Profile
@rixth
rixth / gist:1088478
Created July 18, 2011 03:15
jquery bookmarklet
/**
* This is a template bookmarklet that loads jQuery. Also works
* if another library has defined $ itself.
*/
(function () {
var s = document.createElement('script');
s.setAttribute('src', 'http://jquery.com/src/jquery-latest.js');
s.onload = function () {
jQuery.noConflict();
var fetch = (function () {
var scriptStatus = {},
callbackStack = [],
STATUS_LOADING = 1,
STATUS_LOADED = 2;
function requestScript(url) {
if (typeof(scriptStatus[url]) === 'undefined') {
var scriptTag = document.createElement('script');
scriptTag.type = 'text/javascript';
// Cache element clicks
(function () {
var eventTypes = ['click'],
eventStack = [],
handler = function(event) {
document.getElementById('debug').innerHTML += "Caching event\n";
eventStack.push(event);
};
eventTypes.forEach(function (eventType) {
@rixth
rixth / by.js
Created February 3, 2011 18:11 — forked from nonowarn/by.js
(function (win, doc) {
var by = {},
slice = [].slice,
type2method = {
id: "getElementById",
className: "getElementsByClassName",
tagName: "getElementsByTagName",
query: "querySelectorAll"
};
var C = twttr.constants.noob;
B = B || twttr.currentUser;
if (B && twttr.decider.isAvailable("flock")) {
if (B.statusesCount == 0) {
if (B.followersCount > 49) {
return C.notNoob
}
if (B.friendsCount === 0) {
return (B.followersCount ? C.invited : C.total)
} else {
var meryl = require('./vendor/meryl');
meryl.h('GET /hello/{a}/{b}/{c}', function () {
this.send(this.params.a + this.params.b + this.params.c);
});
require('http').createServer(meryl.cgi()).listen(3000);
Index: cmsworkflow/code/ThreeStep/SiteConfigThreeStepWorkflow.php
===================================================================
--- cmsworkflow/code/ThreeStep/SiteConfigThreeStepWorkflow.php (revision 97653)
+++ cmsworkflow/code/ThreeStep/SiteConfigThreeStepWorkflow.php (working copy)
@@ -128,6 +128,7 @@
*/
public function canPublish($member = null) {
if(!$member && $member !== FALSE) $member = Member::currentUser();
+ if (is_numeric($member)) $member = DataObject::get_by_id('Member', $member);
#!/usr/bin/ruby
# Search a users previous 3200 for a keyword.
unless ARGV.size == 2
puts "USAGE: look-for-tweet.rb username terms"
Process.exit
end
username = ARGV.first
# File you want to get before it's deleted
fileToSave = 'blarblarblar'
# If you want to specify a little bit we can trim off the end
# do it here in bytes. This may make the script more likely to
# save your file.
buffer = 0;
# Wait for the file to be created
print "Okay, please start the process that outputs "+fileToSave+"\n";
while true
@rixth
rixth / mco1.cpp
Last active August 29, 2015 14:25
// Start the MCO outputing the main system clock
HAL_RCC_MCOConfig(RCC_MCO, RCC_MCO1SOURCE_SYSCLK, RCC_MCODIV_1);