new Promise((resolve, reject) => {})
const getDinosaur = (name) => {
return new Promise((resolve, reject) => {
resolve({name})| // This is the default html and body font-size for the base rem value. | |
| $rem-base: 16px !default; | |
| $base-font-family: 'din-2014', Arial, sans-serif; | |
| $fallback-font-family: Arial, sans-serif; | |
| // --- Colors --- | |
| $colors: ( | |
| primary: ( | |
| enterpriseGreen: #169a5a, |
| // Drops you in preview mode | |
| javascript:(function() { | |
| var d = document, l = d.location, s = l.search; | |
| d.cookie = 'wcmmode=preview; path=/'; | |
| if (l.href.includes('editor.html') || !l.href.includes('wcmmode=disabled')) { | |
| s = s.replace(/[\?&]?wcmmode=\w*/g, ''); | |
| l.href = l.origin + l.pathname.replace(/\/editor\.html/g, '') + s + (s ? '&' : '?') + 'wcmmode=disabled'; | |
| } else { |
| javascript:(function() { document.location = (document.location.href.search(/[?&]wcmmode=disabled/) < 0 ? document.location.href + (document.location.href.indexOf('?') < 0 ? '?' : (document.location.href.search(/\?./) < 0 ? '' : '&')) + 'wcmmode=disabled' : document.location.toString().replace(/wcmmode=disabled&?/, '')).replace(/[?&]$/, '');if(window.location.href.indexOf("cf#") > -1){location.reload();}})(); |
| // Run this in the F12 javascript console in chrome | |
| // if a redirect happens, the page will pause | |
| // this helps because chrome's network tab's | |
| // "preserve log" seems to technically preserve the log | |
| // but you can't actually LOOK at it... | |
| // also the "replay xhr" feature does not work after reload | |
| // even if you "preserve log". | |
| function createPause() { | |
| console.log('debugger breakpoint applied to beforeunload;'); |
| # Assumes 3 sequential commits: | |
| # | |
| # 1. commit tagged "prettier-before" that added `prettier` depedency and `prettier` script your package.json | |
| # 2. commit that actually ran `prettier` on your entire codebase for the first time | |
| # 3. commit tagged "prettier-after" that fixes any minor issues caused by prettier (e.x. moving eslint-ignore or $FlowFixMe comments around), or just the next commit if there were none | |
| # | |
| # I recommend running these as individual commands, not as a script, in case of merge conflicts | |
| # | |
| # Checkout the non-pretty branch you want to merge | |
| # (or optionally make a new branch with `git checkout -b $YOUR_BRANCH-prettier $YOUR_BRANCH`) |
| // see blog post: http://www.hiddentao.com/archives/2013/07/08/generate-overridable-getters-and-setters-in-javascript/ | |
| Function.prototype.generateProperty = function(name, options) { | |
| // internal member variable name | |
| var privateName = '__' + name; | |
| options = options || {}; | |
| options.get = ('undefined' === typeof options.get ? true : options.get ); | |
| options.set = ('undefined' === typeof options.set ? true : options.set ); | |
| // pre-initialise the internal variable? |
much, much newer and better ?
To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.
| import sublime | |
| import sublime_plugin | |
| class CursorCommand(sublime_plugin.TextCommand): | |
| saved_cursors_map = {} | |
| def run(self, edit, action="add"): | |
| view = self.view | |
| cursors = view.sel() | |
| view_id = view.id() |
| # File Transfer for Pythonista | |
| # ============================ | |
| # This script allows you to transfer Python files from | |
| # and to Pythonista via local Wifi. | |
| # It starts a basic HTTP server that you can access | |
| # as a web page from your browser. | |
| # When you upload a file that already exists, it is | |
| # renamed automatically. | |
| # From Pythonista's settings, you can add this script | |
| # to the actions menu of the editor for quick access. |