Skip to content

Instantly share code, notes, and snippets.

package com.atlantbh.nutch.filter.xpath;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.Arrays;
@nicwolff
nicwolff / .gitconfig
Created August 21, 2012 15:01
Git alias to rebase master branch on origin and rebase current branch on it
[alias]
up = ! git stash && git checkout master && (git pull --rebase | grep 'up to date' && git checkout '@{-1}' || git checkout '@{-2}' ) && git rebase master && git stash pop
@cowlby
cowlby / collection_widget.twig
Created October 17, 2011 23:32
Customizing form collections in Symfony2
{% block collection_widget %}
{% spaceless %}
<div class="collection">
{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': block('collection_item_widget') }) %}
{% endif %}
<div {{ block('widget_container_attributes') }}>
{{ form_errors(form) }}
<ul>
{% for rows in form %}
@tbeseda
tbeseda / gist:1096141
Created July 20, 2011 23:05
Cakefile to watch and recursively concat and compile CoffeeScript automatically.
fs = require 'fs'
{exec} = require 'child_process'
util = require 'util'
growl = require 'growl'
appFiles = [
'src/hasToGoFirst.coffee' # put your files that must be loaded in first into the array
'src/notAsImportantButNeedsToGoBeforeTheRest.coffee'
]
@brikis98
brikis98 / LinkedInClient.coffee
Created June 12, 2011 07:09
LinkedIn API Client in CoffeeScript
OAuth = require('oauth').OAuth
_ = require 'underscore'
class LinkedInClient
@baseUrl: 'https://api.linkedin.com'
@requestTokenUrl: "#{@baseUrl}/uas/oauth/requestToken"
@accessTokenUrl: "#{@baseUrl}/uas/oauth/accessToken"
@authorizeUrl: "#{@baseUrl}/uas/oauth/authorize"
@profileFields: ['id', 'headline', 'first-name', 'last-name', 'public-profile-url', 'picture-url', 'educations', 'positions', 'email-address']
anonymous
anonymous / gist:647448
Created October 26, 2010 18:05
require 'rubygems'
require 'net/ldap'
ldap = Net::LDAP.new
ldap.host = "ldap2.int-evry.fr"
ldap.port = 389
if ldap.bind
treebase = "ou=People,dc=int-evry,dc=fr"
filter = Net::LDAP::Filter.pres("uid") & Net::LDAP::Filter.eq("title", "CL_FE-EM1EM")
@dahnielson
dahnielson / UUID.php
Last active April 5, 2024 21:14
Pure PHP UUID generator
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.