Skip to content

Instantly share code, notes, and snippets.

View andy-williams's full-sized avatar

Andrew Williams andy-williams

View GitHub Profile
@ded
ded / domready.js
Created February 24, 2011 08:46
Smallest x-browser DOM Ready, ever
function r(f){/in/(document.readyState)?setTimeout(r,9,f):f()}
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
describe('Test example.com', function(){
before(function(done) {
client.init().url('http://example.com', done);
});
describe('Check homepage', function(){
it('should see the correct title', function(done) {
client.getTitle(function(err, title){
expect(title).to.have.string('Example Domain');
done();
@debloper
debloper / app.js
Last active October 21, 2022 21:48
A simple WHOIS & Reverse Lookup server written in Node.js. Run `npm install express`, then `node <file>.js` to get the server(s) up
var net = require("net")
, dns = require("dns")
, exp = require("express")
, app = exp();
app.configure(function() {
app.use(exp.logger());
app.use(app.router);
});
@leeper
leeper / gender.R
Last active October 11, 2017 18:37
Gender API Example https://gender-api.com/en/
#' Gets gender by name or email address, optionally by country or IP address.
library("httr")
library("XML")
#' @import httr
#' @import rjson
#' @param name A character string containing a first name, or a character vector containing first names. One must specify name or email.
#' @param email A character string containing an email address with a first name. One must specify name or email.
#' @param country An optional character string containing a two-letter country name, as listed here: https://gender-api.com/en/api-docs
@staltz
staltz / introrx.md
Last active July 8, 2024 15:46
The introduction to Reactive Programming you've been missing
@jamiepollock
jamiepollock / package.manifest
Created September 19, 2014 16:32
A custom umbraco directive which allows the user to bing an umb-editor to a property whilst providing a custom config.
{
javascript: [
'~/App_Plugins/YourPackage/your.controller.js',
'~/App_Plugins/YourPackage/umbraco-editor-with-config.js',
]
}
@bobbygrace
bobbygrace / trello-css-guide.md
Last active May 15, 2024 16:01
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@makmanalp
makmanalp / comparison.md
Last active June 10, 2024 14:24
Angular vs Backbone vs React vs Ember notes

Note: these are pretty rough notes I made for my team on the fly as I was reading through some pages. Some could be mildly inaccurate but hopefully not terribly so. I might resort to convenient fiction & simplification sometimes.

My top contenders, mostly based on popularity / community etc:

  • Angular
  • Backbone
  • React
  • Ember

Mostly about MVC (or derivatives, MVP / MVVM).