Skip to content

Instantly share code, notes, and snippets.

View tdkn's full-sized avatar
😎
Power 💪

Shun Tedokon tdkn

😎
Power 💪
View GitHub Profile
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@O-I
O-I / weighted_random_sampling.md
Last active February 21, 2024 19:02
[TIx 8] Weighted Random Sampling in Ruby

One of the many reasons I love working with Ruby is it has a rich vocabulary that allows you to accomplish your goals with a minimal amount of code. If there isn't a method that does exactly what you want, it's usually possible to build an elegant solution yourself.

Let's take the example of simulating the rolling of a die.

We can represent a die as an array of its faces.

die = [*?⚀..?⚅]
# => ["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"]
@choffmeister
choffmeister / monodevelop4-build.sh
Last active December 14, 2015 16:28
Install MonoDevelop 4 under Ubuntu 12.04 LTS from sources
#!/bin/bash
sudo apt-get install build-essential automake checkinstall intltool git
sudo apt-get install mono-complete mono-addins-utils gtk-sharp2 gnome-sharp2
git clone git://github.com/mono/monodevelop
cd monodevelop
git checkout monodevelop-4.0
git submodule update --init --recursive
./configure
@lowply
lowply / molokai.patch
Created August 14, 2012 18:11
A patch to molokai.vim
--- molokai.vim 2012-08-15 02:26:31.780396257 +0900
+++ molokai.vim 2012-08-15 02:29:12.374546127 +0900
@@ -133,7 +133,7 @@
hi Normal ctermbg=234
hi CursorLine ctermbg=235 cterm=none
else
- hi Normal ctermfg=252 ctermbg=233
+ hi Normal ctermfg=252 ctermbg=none
hi CursorLine ctermbg=234 cterm=none
endif
@hanachin
hanachin / config.yml
Created July 18, 2012 12:22
ふぁぼしゃわー
consumer_key: your_consumer_key_here
consumer_secret: your_consumer_secret_here
users:
- screen_name: favshower
oauth_token: your_oauth_token
oauth_token_secret: your_oauth_token_secret_here
- screen_name: favshower1
oauth_token: your_oauth_token
oauth_token_secret: your_oauth_token_secret_here
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 23, 2024 19:59
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@yuryofujita
yuryofujita / amida.rb
Created June 2, 2012 16:11
あみだくじ みなとRuby会議01
class Amida
def amida_def()
base1 = "| "
base2 = "|---"
base3 = ""
y="|"
records = Array.new(5,base1)
flg = 0
records.each do |elem|
x1 = rand(2)
@asflash8
asflash8 / amida.rb
Created June 2, 2012 10:09
みなとRuby会議01 ソーシャルコーディング あみだくじ
person_num = ARGV.first.to_i
person_names = ('A'..'Z').to_a
height = 10
person_num.times do |p|
print "#{person_names[p]} "
end
puts
@desandro
desandro / dabblet.css
Created May 23, 2012 11:13
Pinterest layout mashed up
/* Pinterest layout mashed up */
/* ----------------------------> See Line 8 of CSS for instructions of how the layout mashes up with Masonry */
div.statcol{ float: left; padding: 0px; vertical-align: middle; overflow: hidden; text-align: left; margin-bottom: 42px; }
/* div.statrow{ padding-top: 0px; vertical-align: middle; clear: both; float: none; } */
div.statrow { width: 100%; margin: 0 auto; overflow: hidden; }
.polaroid { padding: 10px 10px 19px 10px; background-color: #f7f7f7;
display: inline-table; font-style: italic; line-height: 1.45em; }
.statcol:nth-child(4) { padding-bottom: 40px; clear:both; }
.statcol { text-align: center; }
@drewjoh
drewjoh / custom.js
Created January 27, 2012 13:55
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.1)
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {