Skip to content

Instantly share code, notes, and snippets.

View jtomaszewski's full-sized avatar

Jacek Tomaszewski jtomaszewski

View GitHub Profile
@jedahu
jedahu / es5_ng_it.js
Last active December 13, 2015 20:58
Replacement async 'it' for testing AngularJs with Mocha.
function ngIt($injector) {
return function(text, fn) {
it(text, function(done) {
var $rootScope = $injector.get('$rootScope')
, fin
, finished = function(err) {
fin = true;
done(err);
};
fn(finished);
@roydekleijn
roydekleijn / LocalStorage.java
Created March 2, 2013 22:35
Selenium WebDriver Javascript execution for localStorage
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
public class LocalStorage {
private JavascriptExecutor js;
public LocalStorage(WebDriver webDriver) {
this.js = (JavascriptExecutor) webDriver;
}
@jrhames
jrhames / moment-holidays.js
Last active January 19, 2023 03:12
Holidays plugin for Moment.JS
//## Moment.JS Holiday Plugin
//
//Usage:
// Call .holiday() from any moment object. If date is a US Federal Holiday, name of the holiday will be returned.
// Otherwise, return nothing.
//
// Example:
// `moment('12/25/2013').holiday()` will return "Christmas Day"
//
//Holidays:
@ebeigarts
ebeigarts / RAILS_RELATIVE_URL_ROOT.md
Last active April 27, 2025 15:31
RAILS_RELATIVE_URL_ROOT

RAILS_RELATIVE_URL_ROOT

Rails

By default RAILS_RELATIVE_URL_ROOT is used only for asset pipeline.

To namespace your rails routes you need to wrap run MyApp::Application with map in your config.ru:

map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do
@mythril
mythril / weinred.sh
Last active December 18, 2015 10:39
weinre init.d script
#!/bin/bash
### BEGIN INIT INFO
# Provides: weinre
# Required-Start: $remote_fs $syslog networking
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: weinre mobile debugger
# Description: Provides remote front-end debugger for mobile user agents
# like Chrome Inspector or FireBug
@aras-p
aras-p / preprocessor_fun.h
Last active August 7, 2025 15:36
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@ahmeij
ahmeij / open-id-square.svg
Last active January 4, 2016 08:59
yahoo, yahoo-square, outlook, outlook-square, open-id, open-id-square svg's for use with fontcustom
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
git clone https://github.com/adblockplus/adblockpluschrome
cd adblockpluschrome
git clone https://github.com/adblockplus/adblockplus
git clone https://github.com/adblockplus/buildtools
git clone https://github.com/adblockplus/adblockplustests
cd buildtools
git clone https://github.com/adblockplus/jshydra
cd ..
# Build Chrome development environment (you can use either "chrome", "opera" or "safari")
@scottjehl
scottjehl / noncritcss.md
Last active August 12, 2023 16:57
Comparing two ways to load non-critical CSS

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

@staltz
staltz / introrx.md
Last active August 10, 2025 21:23
The introduction to Reactive Programming you've been missing