Skip to content

Instantly share code, notes, and snippets.

View TangChr's full-sized avatar

Christian Tang TangChr

View GitHub Profile
@thinkpad20
thinkpad20 / mushroom.py
Last active August 29, 2015 14:00
Mario mushroom in pure html/css, generated by python. http://jsfiddle.net/z5c5U/
BLACK = {'background-color': 'black'}
WHITE = {'background-color': 'white'}
GREEN = {'background-color': 'green'}
_ = {}
colors = [BLACK, WHITE, GREEN, _]
pixel_size = 10
grid = [[_, _, _, _, _, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, _, _, _, _, _],
[_, _, _, BLACK, BLACK, BLACK, WHITE, GREEN, GREEN, WHITE, BLACK, BLACK, BLACK, _, _, _],
@oyyq99999
oyyq99999 / Md5Hash.java
Last active August 29, 2015 14:06
md5 algo
package oyyq.test.hash.md5;
import static java.lang.String.format;
import java.util.Arrays;
public class Md5Hash {
private static final class Md5TTableGenerator {
@sclark39
sclark39 / class.lua
Last active August 29, 2015 14:08
Lua class lib with 'base' helper method
-- test.lua
-- using the class lib and the introspective base helper method
class 'A'
function A:test()
print "Hi"
end
class 'B' (A)
function B:test()
@thesabbir
thesabbir / infinity.js
Created January 25, 2015 21:55
Infinite Scrolling
var lastPos = 0;
var scrolling = $('#scrolling-item');
scrolling.on('scroll', function () {
var height = scrolling.height();
var scrollHeight = scrolling[0].scrollHeight;
var scrollTop = scrolling.scrollTop()+1;
if (lastPos < scrollTop) {
if (scrollTop >= scrollHeight - height) {
console.log('Loading..');
}
anonymous
anonymous / Stylish-Social-Buttons.markdown
Created April 1, 2015 03:02
Stylish Social Buttons
@jljorgenson18
jljorgenson18 / gist:d05d21e034de987e569a
Last active August 29, 2015 14:18
Finds an element using an id or a css class and smoothly scrolls to that element. Duration of the animation depends on scroll position. Based off of a stackoverflow answer by bfred.it at http://stackoverflow.com/questions/21474678/scrolltop-animation-without-jquery . NOTE: This only works for scrolling "up" to an element at the moment. The extra…
var scrollTo = function(id, cls, offset) {
var ele;
var targetOffset = 0;
var targetTop = 0;
if(offset) {
targetOffset = offset;
}
if(id) {
ele = document.getElementById(id);
anonymous
anonymous / Wake up, Neo...reloaded.markdown
Created May 26, 2015 22:06
Wake up, Neo...reloaded
anonymous
anonymous / my.css
Created September 20, 2015 01:55
CSS Gradient Animation
background: linear-gradient(270deg, #ff0404, #ff9400, #f9ff00, #00ff15, #0600ff, #af00ff);
background-size: 1200% 1200%;
-webkit-animation: AnimationName 3s ease infinite;
-moz-animation: AnimationName 3s ease infinite;
-o-animation: AnimationName 3s ease infinite;
animation: AnimationName 3s ease infinite;
@-webkit-keyframes AnimationName {
    0%{background-position:0% 50%}
    50%{background-position:100% 50%}
    100%{background-position:0% 50%}
@joshuadavidnelson
joshuadavidnelson / remove-feeds.php
Last active May 26, 2017 23:33 — forked from chrisguitarguy/remove-feeds.php
Remove all feeds from WordPress
<?php
add_action( 'wp_head', 'remove_feeds_from_wp_head', 1 );
/**
* Remove feed links from wp_head
*/
function remove_feeds_from_wp_head() {
// Remove feed links
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
@irazasyed
irazasyed / git-changelog.sh
Last active July 15, 2017 13:28
Shell: Generate Git-Changelog
#!/bin/sh
CHANGELOG_FILE=CHANGELOG.md
FORMAT=" * [%h](../../commit/%h) - %s"
if test "$CHANGELOG_FILE" != ""; then
rm -rf $CHANGELOG_FILE
touch $CHANGELOG_FILE
fi