This file contains hidden or 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
import code | |
code.interact(local=vars()) |
This file contains hidden or 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
./manage.py shell | |
In [1]: %load_ext autoreload | |
In [2]: %autoreload 2 | |
And from now all imported modules would be refreshed before evaluate. | |
In [3]: from x import print_something | |
In [4]: print_something() | |
Out[4]: 'Something' |
This file contains hidden or 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
# Bielsko-Biała | |
[[[18.945534,49.7543281],[18.9454293,49.7539658],[18.9454344,49.7535123],[18.9453771,49.7531567],[18.9458014,49.7526659],[18.9460281,49.7523424],[18.9460746,49.7521745],[18.9462386,49.7520779],[18.9463344,49.7520035],[18.9467296,49.7515927],[18.9471443,49.7511941],[18.947692,49.7506462],[18.9484559,49.7499998],[18.9489191,49.7495728],[18.9497189,49.7487706],[18.9498264,49.748648],[18.9507762,49.7477497],[18.9511399,49.7475348],[18.9515801,49.7470552],[18.9523969,49.7463483],[18.952746,49.7459476],[18.9532457,49.7455795],[18.9538326,49.7453521],[18.9544998,49.7450259],[18.9545791,49.7443403],[18.9545941,49.7441507],[18.9554748,49.7438228],[18.9561844,49.743708],[18.9573002,49.743763],[18.9602408,49.7434956],[18.9623824,49.7440933],[18.9634586,49.7443329],[18.9652151,49.7451171],[18.9661261,49.745019],[18.9678644,49.7445767],[18.9687532,49.7442561],[18.9708332,49.7436945],[18.9711005,49.7436339],[18.9717638,49.7434834],[18.972555,49.7432671],[18.9739327,49.7424794],[18.9749429,49.7415922],[18.97 |
This file contains hidden or 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
#!/bin/bash -l | |
# After empty repository has been created in deployment location | |
# and added as a remote to development repository i.e. local machine | |
# add and edit this file to /hooks/post-recieve | |
GIT_REPO=$HOME/roisin_beauty_ie_backend_strapi.git | |
PUBLIC_WWW=/home/pawel/roisin_beauty_ie | |
PUBLIC_WWW_BACKEND=/home/pawel/roisin_beauty_ie/backend |
This file contains hidden or 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
import React, { Component} from 'react'; | |
import RespGallery from './components/RespGallery'; | |
const IMAGES = [{ | |
src: '/images/1.jpg', | |
thumbnail: '/images/1.jpg', | |
caption: 'Lorem 1', | |
}, { | |
src: '/images/2.jpg', | |
thumbnail: '/images/2.jpg', |
This file contains hidden or 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
/* | |
* Handling Errors using async/await | |
* Has to be used inside an async function | |
*/ | |
try { | |
const response = await axios.get('https://site/api/v1/hehe/') | |
// Success | |
console.log(response); | |
} catch (error) { | |
// Error |
This file contains hidden or 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 Croppeable | |
include ActiveSupport::Concern | |
include Rails.application.routes.url_helpers | |
def crop_and_save(fileName=nil, caption=nil, image_options = {}) | |
redraw_params = create_redraw_params(image_options) | |
processed_attachment_path = create_variant(redraw_params) | |
save_new_file(fileName, caption, processed_attachment_path) | |
end |
This file contains hidden or 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 docReady(fn) { | |
// see if DOM is already available | |
if (document.readyState === "complete" || document.readyState === "interactive") { | |
// call on next available tick | |
setTimeout(fn, 1); | |
} else { | |
document.addEventListener("DOMContentLoaded", fn); | |
} | |
} |
This file contains hidden or 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
fetch("/admin/media/" + mediaId + "/update_image", { | |
method: 'post', | |
body: JSON.stringify(myData), | |
headers: { | |
'Content-Type': 'application/json', | |
'X-CSRF-Token': Rails.csrfToken() | |
}, | |
credentials: 'same-origin' | |
}).then(function(response) { | |
return response.json(); |
This file contains hidden or 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
let slugify = function(text) { | |
return text.toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
NewerOlder