Skip to content

Instantly share code, notes, and snippets.

View hybridknight's full-sized avatar

Metwara Narksook hybridknight

View GitHub Profile
@hybridknight
hybridknight / grayscale.css
Created September 2, 2016 18:40
Turn website to grayscale
html {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
filter: grayscale(100%);
}

Keybase proof

I hereby claim:

  • I am hybridknight on github.
  • I am hybridknight (https://keybase.io/hybridknight) on keybase.
  • I have a public key whose fingerprint is E751 0CE0 6D05 1F95 1EC6 0772 845E DBDC E249 921A

To claim this, I am signing this object:

.iti-flag {
width:20px;
height:15px;
box-shadow:0 0 1px 0 #888;
background-image:url(../img/flags.png);
background-repeat:no-repeat;
background-color:#DBDBDB;
background-position:20px 0;
}
[
{
"name":"Afghanistan (‫افغانستان‬‎)",
"iso2":"af",
"dialCode":"93",
"priority":0,
"areaCodes":null
},
{
"name":"Albania (Shqipëri)",
@hybridknight
hybridknight / typeahead_helper.rb
Created June 23, 2015 11:10
typeahead.js spec support for capybara, poltergeist, and selenium
def fill_in_autocomplete(selector, value)
find("#{selector}.typeahead.tt-input").native.send_keys value
end
def choose_autocomplete(text)
expect(page).to have_css(".tt-suggestion p", text: text, visible: false)
script = %Q{ $('.tt-suggestion:contains("#{text}")').click() }
page.execute_script(script)
end
javascript:var interval = setInterval(function(){ $("#box span[style='background-color: " + _.invert(_.countBy(_.map($("#box span"),function(e){return $(e).css("background-color")}), function(e){ return e}))[1] + ";']").click() }, 100)
@hybridknight
hybridknight / 42.js
Created February 5, 2015 17:18
42.js
["3" -+-+-+ "1" + "1" / "3" * "6"] + [! + [] + ! + []]
var cherry = _.values(Map.cherries)[0];
var grid = new PF.Grid(Map.width, Map.height);
var map = _.clone(Map);
var me = map.me;
var snakes = map.snakes;
delete snakes[me.id];
_.each(me.body, function(body){
grid.setWalkableAt(body.x, body.y, false);
});
_.each(_.values(snakes), function(snake){
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
function method1() {
tryCallApi(function doIt(value) {
// use value
});
}
function tryCallApi(callback) {
var result = callApi();
result && callback(result);
}