Skip to content

Instantly share code, notes, and snippets.

View CharlesInteractive's full-sized avatar
🛰️
On a mission.

Charles Carroll CharlesInteractive

🛰️
On a mission.
View GitHub Profile
const hash = require("crypto-js/sha256");
class Block {
constructor(previousHash, data) {
this.data = data;
this.hash = this.calculateHash();
this.previousHash = previousHash;
this.timeStamp = new Date();
this.proofOfWork = 0;
}
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active June 2, 2024 11:24
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
$.getJSON("mydata.json", function(data) {
var html = '';
$.each(data, function(key, value){
html += '<div class="dcell">';
html += '<img src="images/'+value.product+'.png"/>';
html += '<label for="'+value.product+'">'+value.name+':</label>';
html += '<input type="text" id="'+value.product+'" name="'+value.product+'" value="0" stock="'+value.stock+'" price="'+value.price+'" required>';
html += '</div>';
});
$('#yourContainerId').html(html);
<rules>
<rule name="Remove www" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^www\.(.+)$" />
</conditions>
<action type="Redirect" url="http://{C:1}/{R:0}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
@joshbeckman
joshbeckman / animatedScrollTo.js
Created September 30, 2013 14:51
ScrollTo animation using pure javascript and no jquery
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;
@kmaida
kmaida / convert-UNIX-timestamp.js
Last active March 16, 2023 09:31
Convert a UNIX timestamp to user's local time via JavaScript
function convertTimestamp(timestamp) {
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds
yyyy = d.getFullYear(),
mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.
dd = ('0' + d.getDate()).slice(-2), // Add leading 0.
hh = d.getHours(),
h = hh,
min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.
ampm = 'AM',
time;
@petehamilton
petehamilton / README.md
Last active March 9, 2022 02:43
Set up a Raspberry Pi to load a web dashboard

Dashboards on Raspberry Pi

curl -L 'http://git.io/h1iuxQ' | sh
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007