This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(app_name_domain_controller, [Req]). | |
-compile(export_all). | |
all('GET', [Type]) -> | |
% TODO: expand flexibility of filtering interface | |
{json, boss_db:find(list_to_atom(Type), lists:map(fun({K, V}) -> {list_to_atom(K), 'equals', V} end, | |
Req:query_params()), [{order_by, last_update}, {order, desc}])}. | |
show('GET', [Id]) -> | |
Model = boss_db:find(Id), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update wp_term_taxonomy as tt | |
left join (select term_taxonomy_id as tid, count(term_taxonomy_id) as real_count | |
from wp_term_relationships as tr | |
left join wp_posts as p on tr.object_id = p.ID | |
where p.post_status = "publish" | |
group by tid) | |
as rc | |
on rc.tid = tt.term_taxonomy_id | |
set tt.count = rc.real_count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RCipher | |
def take(s, n, stream) | |
x = 0 | |
val = s | |
acc = [] | |
while x < n do | |
val = stream.call(val) | |
acc.push(val) | |
x += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An exercise in controlled side effects inspired by | |
# http://tmd.io/code/2015/01/27/putting-away-your-laundry-a-look-at-service-objects-for-rails.html | |
# Generic "immutable" wrapper for hash of values and hash of validators | |
# Only unvalidated or Valid values come out of #to_h | |
# Validators can return ValidatedParams::Error('message') to come out of #errors | |
# This is a great candidate for property based testing and has no dependencies beyond hashes and procs | |
class ValidatedParams | |
Valid = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$site_list = get_blog_list(); | |
foreach ($site_list as $site) | |
{ | |
switch_to_blog($site_list['blog_id']); | |
wp_signon($credentials); | |
} | |
restore_current_blog(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mainQuery = { | |
'ids': 'FILL_THIS_IN', | |
'start-date': '2012-01-19', | |
'end-date': '2012-02-05' | |
'dimensions': 'ga:pageTitle,ga:hostName,ga:pagePath,ga:date', | |
'metrics': 'ga:pageviews,ga:visits,ga:timeOnSite', | |
'sort': '-ga:pageviews', | |
'max-results': 100000 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nGramr = {} | |
nGramr.words = prompt('Whats the phrase?').split(' '); | |
nGramr.wordlen = nGramr.words.length; | |
nGramr.depth = prompt('Whats the n?'); | |
nGramr.results = 0; | |
nGramr.grams = function(aWords) { | |
var words = aWords; | |
var depth = words.length; | |
console.log(depth); | |
_.each(nGramr.words, function(word) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
function Drawium_explain_box_displayed(index){ | |
console.log(index); | |
$("#binno-custom-tabs li").unbind('click.drawium'); | |
if (index == 1) { | |
$(".drawium_next_button").remove(); | |
$("#binno-custom-tabs li:nth-child(2)").bind('click.drawium', function() { | |
Drawer.tutorial_next(); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var tourApp = { | |
tabSteps: { | |
3: 'images', | |
10: 'users', | |
}, | |
needsTweaking: function(i) { | |
return typeof tourApp.tabSteps[i] != 'undefined'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tourApp = { | |
tabSteps: { | |
8: 'images', | |
12: 'users' | |
}, | |
needsTweaking: function(i) { | |
return typeof tourApp.tabSteps[i] != 'undefined'; | |
}, | |
OlderNewer