Skip to content

Instantly share code, notes, and snippets.

View nicosantangelo's full-sized avatar

Nicolas Santangelo nicosantangelo

View GitHub Profile
@nicosantangelo
nicosantangelo / git_messages_in_a_day.rb
Created October 9, 2014 04:00
Print or copy all git commit messages from a single day.
#!/usr/bin/env ruby
require 'optparse'
require 'date'
options = {
branch: '',
day: Date.today.day,
month: Date.today.month,
year: Date.today.year,
@nicosantangelo
nicosantangelo / private_pub_auth.rb
Last active August 29, 2015 14:03
Pirvate pub auth to be able to create a ruby client
class PrivatePubAuth
def initialize channel, secret
@config = {
timestamp: (Time.now.to_f * 1000).round,
secret_token: secret,
channel: channel
}
end
def outgoing(message, callback)
@nicosantangelo
nicosantangelo / jquery.flicker.js
Last active June 5, 2018 14:46
jQuery plugin to make an element style flicker.
// Basic usage: $(element).flicker();
// By default it will animate the opacity of the element to make it flicker from visible to invisible
// The options are (the values shown are the defaults)
// {
// action: "start", // Can be "start" or "stop"
// wait: 650, // Time between animations
// cssProperty: "opacity" // Which css style animate. Will be used in jQuerys .css().
// cssValue: "0" // Max value to use
// }
//
@nicosantangelo
nicosantangelo / Gruntfile.js
Created February 17, 2014 18:05
grunt-watch configuration to run with Rails and Jasmine (grunt-contrib-jasmine)
// This file expects the specs to have the same name ending with '.spec.js' and to be in the same folder structure than the source
// Example:
// /app/assets/javascripts/models/todo.js
// /spec/javascripts/models/todo.spec.js
// It runs only the spec of the changed file or, if it's not found, runs the entire suite
module.exports = function(grunt) {
grunt.initConfig({
jasmine: {
all: {
@nicosantangelo
nicosantangelo / CustomHtmlWriter.cs
Created September 3, 2012 14:23
Extension class for XmlTextWriter so it doesn't close empty tags and leaves a new line between them. This won't produce A well indented HTML, but the new line will prevent a bad render. Credits: http://goo.gl/Kmi76
public class CustomHtmlWriter: XmlTextWriter
{
string openingElement = "";
//The list could be simply a string, or whatever you need
List<string> fullyClosedElements = new List<string>();
public CustomHtmlWriter(StringBuilder sb) : base(new StringWriter(sb))
{
//The Rest of the tags would be explicitely closed.
@nicosantangelo
nicosantangelo / result.html
Created August 31, 2012 18:53
Problem with XSL indentation. See this SO question http://goo.gl/f4gjh
<div class="parent">
<div class="child">
<h4 class="title">Title</h4>
</div>
<div class="Tag"><a href="#">
some text
</a><a href="#">
some text
</a><a href="#">
some text
@nicosantangelo
nicosantangelo / PerformanceManager.cs
Created August 27, 2012 19:50
Get performance usage for c#
using System.Diagnostics;
public static class PerformanceManager
{
static PerformanceCounter cpuCounter;
static PerformanceCounter ramCounter;
static PerformanceManager()
{
cpuCounter = new PerformanceCounter();