Skip to content

Instantly share code, notes, and snippets.

View lasryaric's full-sized avatar

Aric Lasry lasryaric

  • San Francisco Bay Area
View GitHub Profile
@lasryaric
lasryaric / fd.c
Created July 17, 2013 19:02
fd.c file descriptor limit checker
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
int main()
{
int i = 0;
while (i < 66000) {
int fd = open("file.txt", O_RDONLY);
producteevApp.dateHelper = function (date, region, timezoneOffset)
{
//For timezone handling, check: http://stackoverflow.com/questions/10438579/getting-moment-js-to-show-datetimes-appropriate-to-info-being-viewed
//TODO: test this function for cross browser compatibility
//example : moment("2013-01-15T06:34:09+0000");
var momentInstance = moment(date);
momentInstance = (momentInstance && momentInstance.isValid()) ? momentInstance : moment(); //valid date || now()
if (_.isUndefined(timezoneOffset)) {
throw ("timezoneOffset not defined");
}
@lasryaric
lasryaric / runx.js
Created August 17, 2012 02:27
runx.js
function runx (func, n, wait, args)
{
var count = 0;
var f = function()
{
if (count < n)
{
func.apply(this, args);
setTimeout(f, wait);
@lasryaric
lasryaric / config_update.sh
Created May 31, 2012 01:02
Cross server configuration script
#!/bin/bash
# You can synchronize the configuration of multiple servers using git and this very small script.
# Just add your servers in a file called "serverlist.txt" (one per line) and
# configure git on the $REMOTE_DIRECTORY_CONFIG. Personnaly, I use the root of the server (/)
# You can also use git hook post-update to run a command after the update
# of the config files if you wish.
SERVERS_FILE="serverlist.txt"
REMOTE_DIRECTORY_CONFIG="/"
@lasryaric
lasryaric / FacebookEventGetUsersList.js
Created August 2, 2011 02:42
Facebook events get users list
if (!all_list)
{
var all_list = [];
}
var pattern_search = '.fsl.fwb.fcb a';
var current_list = [];
var links = $$(pattern_search);
var value;
var i = 0;
while (i < links.length)