Skip to content

Instantly share code, notes, and snippets.

View tomwayson's full-sized avatar
💭
Rockin' the dad jeans

Tom Wayson tomwayson

💭
Rockin' the dad jeans
View GitHub Profile
<!-- This is a quick rundown of how I got geotagging working in Tumblr via javascript and some hacking. Its in use at http://jpinjapan.tumblr.com - I hope tumblr builds it into their site soon! -->
<!-- This has to go somewhere at the top of your page, inside your <head>, as javascript -->
<!-- It prepares the regular expression that finds the geo: tags inside your various tags -->
var geore = new RegExp(/^geo:(-?\d+\.\d+);(-?\d+\.\d+)$/)
<!-- You must alter every <div> containing a post to look like this: -->
<div class="post text" id="post-{PostID}">
<!-- This is so that the javascript can find the posts it needs to. Its a hack around my unfamiliarity with jQuery really. -->
@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!"
@nzakas
nzakas / gist:5511916
Created May 3, 2013 17:47
Using GitHub inside a company

I'm doing some research on how companies use GitHub Enterprise (or public GitHub) internally. If you can help out by answering a few questions, I'd greatly appreciate it.

  1. What is the primary setup? Is there an organization and each official repo is owned by that organization?
  2. Does every engineer have a fork of each repo they're working on?
  3. Are engineers allowed to push directly to the official repo? Or must all commits go through a pull request?
  4. Do engineers work on feature branches on the main repo or on their own forks?
  5. Do you require engineers to squash commits and rebase before merging?
  6. Overall, what is the workflow for getting a new commit into the main repository?
  7. What sort of hooks do you make use of?
  8. Are there any ops issues you encountered? (Scaling, unforeseen downtime, etc.)
@ryoppy
ryoppy / getQueryParams.js
Last active March 28, 2019 17:31
Parse query string. use Underscore.js.
/**
* Parse query string.
* ?a=b&c=d to {a: b, c: d}
* @param {String} (option) queryString
* @return {Object} query params
*/
getQueryParams: function(queryString) {
var query = (queryString || window.location.search).substring(1); // delete ?
if (!query) {
return false;
@odoe
odoe / myservicespec.js
Created December 9, 2013 15:22
Sample of using Sinon to stub modules in Dojo AMD.
define([
'esri/tasks/FindTask',
'dojo/promise/Promise',
'widgets/search/searchservice'
], function(
FindTask,
Promise,
Widget) {
return describe('widgets/search/searchservice', function() {
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 18, 2024 16:07
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@demisx
demisx / angularjs-providers-explained.md
Last active March 17, 2024 11:09
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@DavidSpriggs
DavidSpriggs / async.js
Created June 3, 2014 19:04
dojo async plugin
/*global dojoConfig */
define(function() {
var cb = '_asyncApiLoaderCallback';
return {
load: function(param, req, loadCallback) {
if (!cb) {
return;
} else {
dojoConfig[cb] = function() {
delete dojoConfig[cb];
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@kristianmandrup
kristianmandrup / Converting libraries to Ember CLI addons.md
Last active April 21, 2023 17:14
Guide to Developing Addons and Blueprints for Ember CLI

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.