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
<?php | |
$dbh = new PDO('mysql:host=localhost;dbname=[your-database]', "[your-user]", "[your-password]"); | |
//menampilkan data per-page nya $perPage= 3; | |
// get page. mengambil nilai dari get page | |
$page = isset($_GET['page'])? (int)$_GET['page']:1; |
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
$.ajax({ | |
url: "https://newsapi.org/v1/articles?source=the-next-web&sortBy=latest&apiKey=e9717e4bd91642dabcdec078ea76c03e", | |
json: "callback", | |
dataType: "json", | |
success: function( response ) { | |
$.each(response.articles, function(i, data){ | |
console.log(data); // server response | |
}); |
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
{ | |
author: "Josiah Motley", title: "Steps you can take to help protect yourself from the next KRACK attack", description: "So, by now, you’ve probably heard of the KRACK vul… access to Wi-Fi networks through the core WPA2 …", url: "https://thenextweb.com/contributors/2017/10/17/steps-can-take-help-protect-next-krack-attack/", urlToImage: "https://cdn0.tnwcdn.com/wp-content/blogs.dir/1/files/2017/10/KRACK-main-tnw-social.jpg", …} | |
author : "Josiah Motley" | |
description : "So, by now, you’ve probably heard of the KRACK vulnerabilities and the announcement made through a website that credits Mathy Vanhoef of imec-DistriNet with the discovery. While, there is a lot of technical jargon, what is essentially happening with this vulnerability is that it gives people easy access to Wi-Fi networks through the core WPA2 …" | |
publishedAt : "2017-10-17T14:24:47Z" | |
title : "Steps you can take to help protect yourself from the next KRACK attack" | |
url : "https://thenextweb.com/contributors/2017/10/17/steps-can-take-help |
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
Clone this : | |
git clone https://github.com/Anomareh/PHP-Twig.tmbundle.git | |
Selanjutnya | |
* buka sulime-text | |
* tekan ctrl+shif+p (linux,windows) | |
* ketik browser package lalu enter | |
* buat folder dengan nama PHP-Twig | |
* lalu buka package yang sudah didownlad tadi. pindahkan file yang ada di dalam DIR PHP-Twig.tmbundle/Syntaxes | |
kedalam folder PHP-Twig. |
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
<input id="file" type="file"> | |
<script> | |
document.getElementById("file").onchange = function() { | |
alert(document.getElementById("file").files[0]); | |
} | |
</script> | |
<!-- onchange ; mening when where is a change --> |
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
sudo mv /var/lib/dpkg/info/{packagename}.* /tmp/ | |
sudo dpkg --remove --force-remove-reinstreq {packagename} | |
sudo apt-get remove {packagename} | |
sudo apt-get autoremove && sudo apt-get autoclean |
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
// sending to sender-client only | |
socket.emit('message', "this is a test"); | |
// sending to all clients, include sender | |
io.emit('message', "this is a test"); | |
// sending to all clients except sender | |
socket.broadcast.emit('message', "this is a test"); | |
// sending to all clients in 'game' room(channel) except sender |
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
io.sockets.adapter.rooms["ROOM_NAME"].sockets | |
reference | |
https://stackoverflow.com/questions/35249770/how-to-get-all-the-sockets-connected-to-socket-io/35251958 |
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
var app = require('express')(); | |
var http = require('http'); | |
var httpServer = http.createServer(app); | |
var io = require('socket.io')(httpServer); | |
/** | |
* get unique data | |
*/ | |
function onlyUnique(value, index, self) { | |
return self.indexOf(value) === index; |
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 doPost(e) { | |
var token = "873868937:AAFEeWnw-nebX6KFwHLKspDlZHPehwYcsbo"; | |
var stringJson = e.postData.getDataAsString(); | |
var updates = JSON.parse(stringJson); | |
var chatId = updates.message.chat.id; | |
var messageId = updates.message.message_id; |
OlderNewer