Skip to content

Instantly share code, notes, and snippets.

View Werninator's full-sized avatar
👀

Patrick Werner Werninator

👀
  • Germany
View GitHub Profile
@Calinou
Calinou / CHANGELOG.md
Last active May 25, 2023 19:07
Godot 4.0 preliminary changelog (does not list changes that were also backported to Godot 3.x)

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog.

[4.0] - TBD

Added

@padolsey
padolsey / friday.js
Created August 16, 2013 09:26
Utilities for Friday
function isItFriday() {
return new Date().getDay() === 5 ?
'It is!' :
'It is not.';
}
function whenWillItBeFriday() {
var d = 5 - new Date().getDay();
return d === 0 ?
'Right now!' :
@crtr0
crtr0 / client.js
Created June 8, 2012 17:02
A simple example of setting-up dynamic "rooms" for socket.io clients to join
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
@travisjeffery
travisjeffery / angular-focus.html
Created May 3, 2012 18:49
Angularjs Focus Directive
<script>
angular.directive('tj:focus', function(){
return function(scope, element){
element[0].focus();
};
});
</script>
<div>
<input type="text" ng:model="model" tj:focus />
@bentruyman
bentruyman / slug.js
Created September 12, 2011 14:31
JavaScript Slug Generator
// Generates a URL-friendly "slug" from a provided string.
// For example: "This Is Great!!!" transforms into "this-is-great"
function generateSlug (value) {
// 1) convert to lowercase
// 2) remove dashes and pluses
// 3) replace spaces with dashes
// 4) remove everything but alphanumeric characters and dashes
return value.toLowerCase().replace(/-+/g, '').replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
};
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}