Skip to content

Instantly share code, notes, and snippets.

View pdokas's full-sized avatar
🌵
Fnord

Phil Dokas pdokas

🌵
Fnord
View GitHub Profile
javascript:void%28s%3Dprompt%28%27Find%20text%3A%27%2C%27%27%29%29%3Bs%3D%27%28%27+s+%27%29%27%3Bx%3Dnew%20RegExp%28s%2C%27gi%27%29%3Brn%3DMath.floor%28Math.random%28%29*100%29%3Brid%3D%27z%27%20+%20rn%3Bb%20%3D%20document.body.innerHTML%3Bb%3Db.replace%28x%2C%27%3Cspan%20name%3D%27%20+%20rid%20+%20%27%20id%3D%27%20+%20rid%20+%20%27%20style%3D%5C%27color%3A%23000%3Bbackground-color%3Ayellow%3B%20font-weight%3Abold%3B%5C%27%3E%241%3C/span%3E%27%29%3Bvoid%28document.body.innerHTML%3Db%29%3Balert%28%27Found%20%27%20+%20document.getElementsByName%28rid%29.length%20+%20%27%20matches.%27%29%3Bwindow.scrollTo%280%2Cdocument.getElementsByName%28rid%29%5B0%5D.offsetTop%29%3B
@pdokas
pdokas / SassMeister-input.scss
Created February 3, 2016 21:48
Generated by SassMeister.com.
// ----
// libsass (v3.3.2)
// ----
@mixin blue {
color: blue;
}
@mixin border {
border: 1px solid black;
}
@pdokas
pdokas / SassMeister-input.scss
Created February 3, 2016 21:47
Generated by SassMeister.com.
// ----
// libsass (v3.3.2)
// ----
%blue {
color: blue;
}
%border {
border: 1px solid black;
}
var asap = (function(global) {
"use strict";
// Use the fastest possible means to execute a task in a future turn
// of the event loop.
// linked list of tasks (single, with head node)
var head = {task: void 0, next: null};
var tail = head;
var flushing = false;
@pdokas
pdokas / tags.html
Last active December 19, 2015 15:48
The simplest way I can find to find a sorted list of all tags across all posts in Siteleaf.
{% capture tags %}
{% for post in site.posts %}
{% for tag in post.taxonomy.tags %}
{{tag.value}}\{{tag.url}}{% unless forloop.last %},{% endunless %}
{% endfor %}
{% endfor %}
{% endcapture %}
{% assign tags = tags | strip_newlines | split:',' | sort %}
@pdokas
pdokas / gist:5072329
Created March 2, 2013 18:18
Flickr: Make a photo public and uploaded now
javascript:(function(){if(confirm('This will set the date posted to now, and make the photo public for all to see.')){FLICKR.photo.setDatePosted(Math.round((new Date()).getTime()/1000));FLICKR.photo.setPerms({is_public:1});}})();
@pdokas
pdokas / Ember view code & models.md
Created February 2, 2013 19:44
How can you delay an Ember.View’s DOM-based code until the Ember Data model has fully loaded?

Ember’s ability to automatically re-render a view when its model changes is awesome. Like “holy shit, that was basically magic” awesome. But there’s a common task that’s so similar but perplexingly more difficult. It’s using data from the model’s records in the view’s jQuery code (or really any clientside DOM library, but Ember bundles jQuery, so let’s be simple and assume jQuery).

For instance, if this is my router:

App.IndexRoute = Ember.Route.extend({
	model: function(params) {
		return App.Gallery.find();
	},
	setupController: function(controller, model) {
± ~/dev/ember.js (master ✓) ⚡ rake -V
rake, version 10.0.3
± ~/dev/ember.js (master ✓) ⚡ rake dist
/usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25: warning: redundant nested repeat operator
rake aborted!
cannot load such file -- bundler/setup
/Users/pdokas/dev/ember.js/Rakefile:3:in `<top (required)>'
(See full trace by running task with --trace)
± ~/dev/ember.js (master ✓) ⚡ rake dist --trace
/usr/local/Cellar/ruby/1.9.3-p362/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25: warning: redundant nested repeat operator
@pdokas
pdokas / svn-color.py
Created March 28, 2012 18:37 — forked from rharmes/svn-color.py
Colorize SVN
#
# 1) Alias this: alias svn=/Users/foo/dev/svn-color.py
# 2) Paste the script below into the above file
# 3) chmod 777 <the file>
# 4) Delete this quote block so the env line is line 1
#
#!/usr/bin/env python
"""
@pdokas
pdokas / svn-color.py
Created October 6, 2011 20:03
Colorize SVN
#
# 1) Alias this: alias svn=/Users/foo/dev/svn-color.py
# 2) Paste the script below into the above file
# 3) chmod 777 <the file>
# 4) Delete this quote block so the env line is line 1
#
#!/usr/bin/env python
"""