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
/* | |
* This decorates Handlebars.js with the ability to load | |
* templates from an external source, with light caching. | |
* | |
* To render a template, pass a closure that will receive the | |
* template as a function parameter, eg, | |
* T.render('templateName', function(t) { | |
* $('#somediv').html( t() ); | |
* }); | |
* Source: https://github.com/wycats/handlebars.js/issues/82 |
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
import org.apache.commons.codec.binary.Base64; | |
private String encodeFileToBase64Binary(String fileName) | |
throws IOException { | |
File file = new File(fileName); | |
byte[] bytes = loadFile(file); | |
byte[] encoded = Base64.encodeBase64(bytes); | |
String encodedString = new String(encoded); |
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
1. Write a hello hello world c | |
main( ) | |
{ | |
printf("Hello World\n"); | |
} | |
2. Compile it: gcc hello.c | |
Bonus: `gcc -Wall -save-temps hello.c -o hello` will give you extra stuff like: |
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
""" | |
The function checks correctness of a routing number using the Checksum algorithm. | |
Checksum algorithm: http://en.wikipedia.org/wiki/Routing_transit_number#Check_digit | |
""" | |
def validate(routing_number): | |
if len(s) != 9: | |
return False | |
n = 0 | |
for i in xrange(0, len(s), 3): |
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
/** | |
* For fun. | |
* Inspiration: http://dis.4chan.org/read/prog/1295544154 | |
* @author zengr | |
* | |
*/ | |
public class Sleepsort { | |
private static int[] inputArray = { 3, 1, 2, 1, 181, 10}; |
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
""" | |
The MIT License | |
Source: https://github.com/simplegeo/python-oauth2/blob/master/example/client.py | |
Copyright (c) 2007 Leah Culver | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights |
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
<div id="lga"> | |
<style> | |
body{overflow:hidden}#hplogo{position:relative;width:0;margin:0 auto;right:190px;height:160px}.particle{position:absolute;z-index:-1}.circle{-moz-border-radius:160px;-webkit-border-radius:160px;-khtml-border-radius:160px;border-radius:160px}#cpf,#sbl,#fctr{background:transparent} | |
</style> | |
<noscript> | |
<style>#hplogo{right:0;width:auto;background:url(/intl/en_ALL/images/srpr/logo1w.png) no-repeat center}</style> | |
</noscript> | |
<div id="hplogo"> | |
<div class="particle circle" style="background-color: rgb(237, 157, 51); height: 18.337px; width: 18.337px; left: 200.733px; top: 77.5385px;"> | |
</div> |
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
#Install scipy: http://glowingpython.blogspot.it/2012/05/analyzing-your-gmail-with-matplotlib.html | |
from imaplib import IMAP4_SSL | |
from datetime import date,timedelta,datetime | |
from time import mktime | |
from email.utils import parsedate | |
from pylab import plot_date,show,xticks,date2num | |
from pylab import figure,hist,num2date | |
from matplotlib.dates import DateFormatter |
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
// | |
// ProgrammaticalDemo.swift | |
// PieCharts | |
// | |
// Created by Hyun Min Choi on 2017. 1. 23.. | |
// Copyright © 2017년 Ivan Schuetz. All rights reserved. | |
// | |
import UIKit | |
import PieCharts |
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
// $(element).center(); | |
jQuery.fn.center = function () | |
{ | |
this.css("position","absolute"); | |
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px"); | |
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px"); | |
return this; | |
} |
NewerOlder