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
enum LETTERS = {dmy, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z}; | |
LETTERS: dummy = dmy; | |
array[int, int] of LETTERS: ADDENDS; | |
array[int] of LETTERS: SOLUTION; | |
array[int] of LETTERS: USED; | |
array[LETTERS] of var 0..9: solution; | |
constraint solution[dummy] = 0; |
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
#Goes in <your_app>/management/commands | |
from collections import OrderedDict | |
from django.core.management.base import BaseCommand, CommandError | |
from django.apps import apps | |
from django.db import models | |
from openpyxl import load_workbook | |
def workbook_name(filename): | |
try: |
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
#Standard. | |
import io | |
#External (`pip install google-api-python-client google-auth-httplib2` should give you these.) | |
from oauth2client.service_account import ServiceAccountCredentials | |
from apiclient.discovery import build | |
from apiclient.http import MediaIoBaseDownload | |
import httplib2 | |
class Tool(): |
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
/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ | |
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e, |
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
public static String stripTags(String input) { | |
return input.replaceAll("\\<.*?>",""); | |
} |
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
@charset "UTF-8"; | |
/*! | |
* animate.css -http://daneden.me/animate | |
* Version - 3.5.1 | |
* Licensed under the MIT license - http://opensource.org/licenses/MIT | |
* | |
* Copyright (c) 2016 Daniel Eden | |
*/ |
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
Function PrettySize([int64]$bytes) { | |
if ( $bytes -gt 1TB ) { $result = [string]::Concat([math]::Round($bytes/1TB, 2), " TB") } | |
elseif ( $bytes -gt 1GB ) { $result = [string]::Concat([math]::Round($bytes/1GB, 2), " GB") } | |
elseif ( $bytes -gt 1MB ) { $result = [string]::Concat([math]::Round($bytes/1MB, 2), " MB") } | |
elseif ( $bytes -gt 1KB ) { $result = [string]::Concat([int]($bytes/1KB), " KB") } | |
$result | |
} |
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
<?php | |
namespace ocra\libraryThing; | |
/** | |
* Search LibraryThing's Common Knowledge API for a book and return and array with author/title and maybe year. | |
*/ | |
function find_by_isbn($isbn) { | |
$lturl = 'http://www.librarything.com/services/rest/1.1/?method=librarything.ck.getwork&isbn=%s&apikey=%s'; | |
$lturl = sprintf($lturl, $isbn, LIBRARYTHING_API_KEY); |
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
// Return the actual location of a web page given a shortened url. | |
// Based in part on this Stack Overflow answer: | |
// http://stackoverflow.com/questions/1519392/how-to-prevent-apache-http-client-from-following-a-redirect | |
import groovyx.net.http.HTTPBuilder | |
import org.apache.http.impl.client.AbstractHttpClient | |
import org.apache.http.params.BasicHttpParams | |
import static groovyx.net.http.Method.HEAD |
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
wordcount <- function(str) { | |
sapply(gregexpr("\\b\\W+\\b", str, perl=TRUE), function(x) sum(x>0) ) + 1 | |
} |
NewerOlder