Skip to content

Instantly share code, notes, and snippets.

View novaknole's full-sized avatar

Giorgi Lagidze novaknole

View GitHub Profile
// you can use includes, for example:
// #include <algorithm>
// you can write to stdout for debugging purposes, e.g.
// cout << "this is a debug message" << endl;
struct Point
{
Point(char tag, int x, int y)
:m_tag(tag)
,m_dist(long(x)*long(x) + long(y)*long(y))
CASE 2: Not First Page Load
SSR: After clicking on a link to move to another page, the browser has to make a request to the server,
which would have to do everything (async calls, creating html, putting data in it) and then returning it.
Operations = html request + async call + creating html + putting data into html
note 1: async call happens from a server, that should be super fast.
note 2: creating html + putting data into html happens on a server, so that should be super fast.
<div class="row">
<div class="child">
</div>
</div>
FB.init({
appId: process.env.FACEBOOK_ID,
version: "v3.3",
status: true,
cookie: true
});
let share = {
method: "feed",
function solution($S, $K) {
// write your code in PHP7.0
print "$S, $K<br>\n";
$min = "";
for($i=0; $i<=strlen($S)-$K-1; $i++) {
$n = $i+$K;
$string = substr($S,0,$i).substr($S,$n);
//print "new string $i $string\n";
$notation = notation($string);
$len = strlen($notation);
self.addEventListener('pushsubscriptionchange', function(event) {
event.waitUntil(
fetch('https://pushpad.xyz/pushsubscriptionchange', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
old_endpoint: event.oldSubscription ? event.oldSubscription.endpoint : null,
new_endpoint: event.newSubscription ? event.newSubscription.endpoint : null,
new_p256dh: event.newSubscription ? event.newSubscription.toJSON().keys.p256dh : null,
new_auth: event.newSubscription ? event.newSubscription.toJSON().keys.auth : null
function askPermission() {
return new Promise(function(resolve, reject) {
const permissionResult = Notification.requestPermission(function(result) {
resolve(result);
});
if (permissionResult) {
permissionResult.then(resolve, reject);
}
class TestPlugin {
apply(compiler) {
compiler.hooks.afterEmit.tap('TestPlugin', (compilation) => {
let options = {}; // some options i will put here
let plugin = new SomePlugin(); // this will be webpack's plugin, not mine
compiler.apply(plugin);
})
}
}
$vehicle = App\Http\Models\Vehicle::findOrFail(2);
return $vehicle->with([
'latestPrice' => function($query) {
$query->where('milleage', 1000)->latest('id');
},
'latestDamage' => function($query){
$query->where('user_id', 1)->latest();
},
'latestDamage.images'
])->first();
data(){
return {
columns: []
}
},
watch: {
dbData: function(val) {
console.log('val', val)
this.pricematrix_name = val.pricematrix_name