This file contains 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
article, aside, dialog, figure, footer, header, hgroup, menu, nav, section {display: block} |
This file contains 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
/* Use this to cause a function to fire no more than once every 'ms' milliseconds. | |
For example, an expensive mousemove handler: | |
$('body').mouseover(ratelimit(function(ev) { | |
// ... | |
}, 250)); | |
*/ | |
function ratelimit(fn, ms) { | |
var last = (new Date()).getTime(); |
This file contains 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
#include <stdio.h> | |
int main() | |
{ | |
unsigned int a = 1, b = 1, c = 2, sum = 0; | |
while (c < 4000000) | |
{ | |
c = a + b; | |
sum += c * !(c % 2); |
This file contains 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
/* | |
Great little debuging snippet found while browsing. | |
The code adds different coloured borders to the assets | |
depending on its level. | |
Leave commented out if not needed. | |
*/ | |
* { outline: 2px dotted red } | |
* * { outline: 2px dotted green } |
This file contains 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
#include <stdio.h> | |
int main( ) | |
{ | |
char string[]={"this is a string"}; | |
char searchchar = 'i'; | |
char replacechar = 'X'; | |
char *ptr; // current position in string |
This file contains 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
/** | |
* Solution by KushalP | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
void condense_by_removing(char *z_terminated, char char_to_remove); |
This file contains 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
/* Pad an Integer with zeros depending on a | |
* given length provided | |
*/ | |
var zeroPad = function(n, totalDigits) { | |
n = n.toString(); | |
var pd = ''; | |
if (totalDigits > n.length) | |
for (i=0; i < (totalDigits-n.length); i++) | |
pd += '0'; |
This file contains 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
#include <stdlib.h> | |
#include <stdio.h> | |
struct list_element | |
{ | |
int val; | |
struct list_element *next; | |
}; | |
typedef struct list_element item; |
This file contains 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
set ai " auto indenting | |
set history=100 " keep 100 lines of history | |
set ruler " show the cursor position | |
syntax on " syntax highlighting | |
set hlsearch " highlight the last searched term | |
filetype plugin on " use the file type plugins | |
" clean up our tab usage | |
set softtabstop=4 | |
set tabstop=4 |
This file contains 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
class LinkedList(object): | |
""" | |
Attempting to learn the basics of ADTs again. | |
Note to self: don't ever use this, stick with list() methods | |
""" | |
class Node(object): | |
def __init__(self, item): | |
self.value = item | |
self.next = None |
OlderNewer