Skip to content

Instantly share code, notes, and snippets.

View dubilla's full-sized avatar

Dan Ubilla dubilla

View GitHub Profile
@loisaidasam
loisaidasam / README.md
Last active April 5, 2023 18:37
The Masters API!
@dy-dx
dy-dx / CoffeeScript.sublime-settings
Last active May 30, 2018 15:35
My custom Sublime Text 3 settings
{
"binDir": "/Users/chris/.nvm/current/bin/"
}
@bhollis
bhollis / blog.js.coffee
Last active July 17, 2021 08:05
A simple, made-up example of the code for a simple AngularJS blog viewer as a more detailed exploration of http://benhollis.net/blog/2014/01/17/cleanly-declaring-angularjs-services-with-coffeescript/ . Yes, I know about `$resource`, but I prefer not to use it.
app = angular.module 'BlogExample', []
# Simple controller that loads all blog posts
app.controller 'BlogCtrl', ['$scope', 'Blog', ($scope, Blog) ->
# Get all the blog posts
Blog.all().then (posts) ->
$scope.posts = posts
# Extend the $scope with our own properties, all in one big block
# I like this because it looks like declaring a class.
@wilsonwc
wilsonwc / stateMock.js
Created January 10, 2014 17:24
Angular Mock for properly resolving ui-router $state in Karma unit tests
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}
}else{
@dy-dx
dy-dx / .bash_profile
Last active June 15, 2021 14:06
My OSX .bash_profile
# shellcheck shell=bash
# shellcheck source=/dev/null
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.fzf.bash" ]] && source "$HOME/.fzf.bash"
export NVM_SYMLINK_CURRENT=true
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$HOME/.asdf/asdf.sh" ] && . "$HOME/.asdf/asdf.sh"
[ -s "$HOME/.asdf/completions/asdf.bash" ] && . "$HOME/.asdf/completions/asdf.bash"
@dy-dx
dy-dx / index.coffee
Created December 9, 2013 16:50
node.js script for listing closed + unmerged pull requests. Useful for tracking closed pull requests that may have been forgotten.
# Configuration
cfg =
oauth_token: ''
repo: 'viewthespace/viewthespace'
number_of_pulls: 40
timeout: 5000
unless cfg.oauth_token.length
return console.error """
Please generate an oauth token and place in cfg object.
@alicial
alicial / mock-service-example.js
Last active June 10, 2019 14:26
AngularJS: Setting up a mocked service to use in controller unit tests.
// Mocked Service
angular.module('mock.users', []).
factory('UserService', function($q) {
var userService = {};
userService.get = function() {
return {
id: 8888,
name: "test user"
}
@davatron5000
davatron5000 / Sublime Text Setup.md
Last active April 15, 2023 15:39
A new user's guide to SublimeText 2. Estimated reading time: 2 mins. Estimated workthrough time: 12 minutes.

Make it useful

  • Install Package Control. For SublimeText 2, paste the following in Terminal:
import urllib2,os; pf='Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler( ))); open( os.path.join( ipp, pf), 'wb' ).write( urllib2.urlopen( 'http://sublime.wbond.net/' +pf.replace( ' ','%20' )).read()); print( 'Please restart Sublime Text to finish installation')

From here on out, use Package Control to install everything. +Shift+P, then type Install to get a list of installable packages you can 'livesearch through. After installing plugins, they should be running.

@sockdrawermoney
sockdrawermoney / deehock-leadership.md
Last active April 2, 2017 07:07
Dee Hock on Leadership

Leader presumes follower. Follower presumes choice. One who is coerced to the purposes, objectives, or preferences of another is not a follower in any true sense of the word, but an object of manipulation. Nor is the relationship materially altered if both parties voluntarily accept the dominance of one by the other. A true leader cannot be bound to lead. A true follower cannot be bound to follow. The moment they are bound they are no longer leader or follower. If the behavior of either is compelled, whether by force, economic necessity, or contractual arrangement, the relationship is altered to one of superior/subordinate, manager/employee, master/servant, or owner/slave. All such relationships are materially different from leader/follower.

Induced behavior is the essence of leader-follower. Compelled behavior is the essence of all the others. Where behavior is compelled, there lies tyranny, however benign. Mere behavior is induced, there lies leadership, however powerful. Leadership does not imply construc

@jakelazaroff
jakelazaroff / backboneconf2013
Last active December 20, 2015 11:19
BackboneConf 2013 notes! http://backboneconf.com/ Disclaimer: sorry for anything I may have missed!
code delimiters: <% %>
# keynote
- your business logic will live longer than your interface
- stateless
- no "spaghetti state"
- application should be able to reflect any combination of data
- views should transparently reflect models
- backbone patterns
- custom model methods