Skip to content

Instantly share code, notes, and snippets.

@Grab('com.itextpdf:itextpdf:5.3.4')
@GrabConfig(systemClassLoader = true)
import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import com.itextpdf.text.pdf.PdfRectangle;
#!/usr/bin/env ruby
require "net/http"
require 'open-uri'
def download(url, acta)
File.open("presidente/#{acta}", "wb") do |saved_file|
# the following "open" is provided by open-uri
open(url, 'rb') do |read_file|
saved_file.write(read_file.read)
define(['marionette'], function (Marionette) {
return Marionette.ItemView.extend({
id: 'search-box',
tagName: 'div',
template: '#search-box-tpl',
ui: {
input: '#search-box-input'
@kaptinlin
kaptinlin / timthumb.php
Created October 19, 2011 02:31
TimThumb with relative path for wordpress themes
<?php
/**
* TimThumb by Ben Gillbanks and Mark Maunder
* Based on work done by Tim McDaniels and Darren Hoyt
* http://code.google.com/p/timthumb/
*
* GNU General Public License, version 2
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Examples and documentation available on the project homepage
@amcdnl
amcdnl / html5_facebook.md
Created September 12, 2012 02:41
HTML5 vs Native Mobile Apps and Facebook

HTML5 vs Native Mobile Apps and Facebook

Recently, Mark Zuckerberg made a comment saying that Facebook's mobile app based on HTML5 was "one of the biggest mistakes if not the biggest strategic mistakes we've ever made". I mean yes the application was TERRIBLE; it crashed all the time, was slow, and had a number of issues but I don't agree.

There is a number of other companies that have great HTML5 applications with just as much complexity ( if not more ) than the Facebook app. The first and best example I can think of is the LinkedIn application. This is a very nice application that performs fine with similar characteristics as the Facebook app.

Windows 8 is basing their whole marketplace around HTML5 applications. While you might argue that the computing power of a desktop is far greater than a phone, the complexity of the applications are going to be greater too.

I argue that making HTML5 applications are the way to go! Why is that?

@evanshajed
evanshajed / media_queries_standard_device.css
Created September 25, 2012 19:50
Media Queries for Standard Devices
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen and (min-width : 321px) {
/* Styles */
/*!
* JavaScript - loadGoogleMaps( version, apiKey, language )
*
* - Load Google Maps API using jQuery Deferred.
* Useful if you want to only load the Google Maps API on-demand.
* - Requires jQuery 1.5
*
* Copyright (c) 2011 Glenn Baker
* Dual licensed under the MIT and GPL licenses.
*/
@taktran
taktran / gmapsDone.js
Last active December 16, 2015 06:09
Load google maps asynchonously and return a function to wrap around a callback function for when google maps finishes loading. Based on http://blog.pixelingene.com/2011/10/using-jquery-dot-deferred-and-requirejs-to-lazy-load-google-maps-api/. Also see http://stackoverflow.com/q/12648598/111884
/*global $:false, window:false */
/**
* Load google maps asynchonously and return a function
* to wrap around a callback function for when google
* maps finishes loading.
*
* Note: need to load jQuery 1.5+ before this module
* is loaded.
*
@jasdeepkhalsa
jasdeepkhalsa / tweet-counter-hourly.js
Last active December 19, 2015 10:19
Show tweets in the last hour in Tweet Counter (this is only the for loop, please see https://github.com/jasdeepkhalsa/tweet-counter/blob/master/tweet-counter.js for the full javascript file). By default brings backs tweets only in the last hour.
var today = new Date(); // By default brings backs tweets only in the last hour. Or just use new Date('Fri Jul 05 13:35:22 +0000 2013'), with a fixed cut off time, to have tweets within the specified time-frame only
// If you do not want the hourly window to change (otherwise "today" will become a moving target of tweets in the last hour each time tweet counter runs, then please put this line at the top of the file, inside the .ready function as follows:
// $(document).ready(function(){ var today = new Date(); })
// Making sure that the variable is defined outside of the var tweetCounter function
// Lets go through each tweet
for (obj in data.statuses) {
var tw_result = data.statuses[obj]; // This is the tweet
var tw_unique_id = tw_result.id_str; // This is the id of the tweet
@terwey
terwey / part1.md
Last active February 1, 2017 22:31
Newscoop 4.2 - A Simple Plugin

Newscoop 4.2 - a Simple Plugin

Just like you I am extremely excited about the release of [Newscoop 4.2] and the new [Symfony Bundles] plugin system. In the following few steps I will demonstrate to you how to get started creating a super simple Plugin for [Newscoop 4.2].

Prerequisites

  • Motivation (we won't get anywhere if you don't have this!)
  • Your favourite code editor
  • Git client
  • (S)FTP Client for connecting to your server
  • Some knowledge of how to use the Terminal