Skip to content

Instantly share code, notes, and snippets.

View oliversalzburg's full-sized avatar
💭
>:(

Oliver Salzburg oliversalzburg

💭
>:(
View GitHub Profile
@shesek
shesek / inject.coffee
Created February 11, 2012 04:10
Executing code in the webpage context from Chrome extensions.
inject = (args..., fn) ->
script = document.createElement 'script'
script.innerHTML = """
Array.prototype.pop.call(document.getElementsByTagName('script')).innerText = JSON.stringify(function() {
try { return #{ fn.toString() }.apply(window, #{ JSON.stringify args }); }
catch(e) { return {isException: true, exception: e.toString()}; }
}());
"""
document.body.appendChild script
response = JSON.parse script.innerText
@kendfrey
kendfrey / darkchat.css
Last active January 2, 2016 21:39
Dark Chat
body {
background-color : #000 !important;
background-image : url("http://raw.github.com/oliversalzburg/se-chat-dark-theme/master/img/skewed_print.png") !important;
color : #ddd !important;
}
.messages {
background-color : #222 !important;
border : none !important;
color : #ddd !important;
@neonichu
neonichu / gplus-post.rb
Created January 30, 2012 01:24
Automatically post to your Google+ account from the commandline.
#!/usr/bin/env ruby
##### Automatically post to your Google+ account from the commandline.
##### (C) 2012 Boris Buegling <boris@icculus.org>
require 'rubygems'
require 'mechanize'
## Use Windows Mobile user agent to get Basic Mobile HTML
agent = Mechanize.new
@gak
gak / fish-prompt.sh
Last active February 4, 2022 18:34
My custom fish prompt code explained at http://geraldkaszuba.com/tweaking-fish-shell/
function _common_section
printf $c1
printf $argv[1]
printf $c0
printf ":"
printf $c2
printf $argv[2]
printf $argv[3]
printf $c0
printf ", "
@Benjol
Benjol / autoreviewcomments.user.js
Last active February 4, 2022 18:34
Add pro-forma comments dialog for reviewing (pre-flag)
// ==UserScript==
// @name AutoReviewComments
// @namespace benjol
// @version 1.3.1
// @description Add pro-forma comments dialog for reviewing (pre-flag)
// @grant none
// @include http*://*stackoverflow.com/questions*
// @include http*://*stackoverflow.com/review*
// @include http*://*stackoverflow.com/admin/dashboard*
// @include http*://*stackoverflow.com/tools*
@matthewmccullough
matthewmccullough / git-deletealltags.bsh
Created April 1, 2011 20:29
Script to delete all tags both locally and remotely
for t in `git tag`
do
git push origin :$t
git tag -d $t
done
//
// E2E Test Setup
// e2e_helpers.js
//
import { getMainDefinition } from '@apollo/client/utilities'
import { AuthPayload } from '../../lib/typings/goodchat'
import { WebSocketLink } from '@apollo/client/link/ws'
import { promisify } from 'util'
import fetch from 'cross-fetch'
@sdieunidou
sdieunidou / rabbitmq.txt
Created October 22, 2015 19:51
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@nickcampbell18
nickcampbell18 / my-test.spec.js
Created October 9, 2023 14:45
Replacing the Undici global dispatch logic with a symbol-less Jest-compatible implementation
test("mocking a request", async () => {
const mockAgent = new MockAgent()
;(global as any).setMockedFetchGlobalDispatcher(mockAgent)
await fetch(...)
})
@hmbilal
hmbilal / debug-ui-router.js
Last active December 13, 2023 14:42
Debugging Angular ui-router routes in browser console.
// Paste this code in browser console to debug ui-router problems when navigating through states.
var $rootScope = angular.element(document.querySelectorAll("[ui-view]")[0]).injector().get('$rootScope');
$rootScope.$on('$stateChangeStart',function(event, toState, toParams, fromState, fromParams){
console.log('$stateChangeStart from '+fromState.name+'- fired when the transition begins. fromState,fromParams : \n',fromState, fromParams);
console.log('$stateChangeStart to '+toState.name+'- fired when the transition begins. toState,toParams : \n',toState, toParams);
});
$rootScope.$on('$stateChangeError',function(event, toState, toParams, fromState, fromParams){