Skip to content

Instantly share code, notes, and snippets.

@koseki
koseki / lscron
Created July 17, 2009 08:44
list all cron jobs.
#! /bin/sh
cat /var/spool/cron/* /etc/crontab | grep '^\(\*\|[0-9]\)' | sort -nk2 -nk1
@ricardobeat
ricardobeat / semaphore.js
Created March 3, 2011 01:30
simple semaphore for parallel async execution, with error handling.
function queue(name){
queue.q[name]++ || (queue.q[name] = 1);
return function(err){
if (err && queue.e[name]) queue.e[name](err);
else if (err) throw err;
process.nextTick(function(){
queue.q[name]--;
queue.check(name);
});
}
@MilkZoft
MilkZoft / list.php
Created February 1, 2012 01:22
codejobs - List files - PHP
<?php
function list_files($dir) {
if(is_dir($dir)) {
if($handle = opendir($dir)) {
while(($file = readdir($handle)) !== FALSE) {
if($file !== "." and $file !== ".." and $file != "Thumbs.db") {
echo '<a target="_blank" href="'. $dir . $file .'">'. $file .'</a><br>'."\n";
}
}

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.

@hzlzh
hzlzh / jQuery.fn.shake.js
Created August 6, 2012 04:51
jQuery shake effect like WordPress Login Form
jQuery.fn.shake = function(intShakes, intDistance, intDuration) {
this.each(function() {
$(this).css({
position: "relative"
});
for (var x = 1; x <= intShakes; x++) {
$(this).animate({
left: (intDistance * -1)
}, (((intDuration / intShakes) / 4))).animate({
left: intDistance
@meleyal
meleyal / jquery.draghover.js
Created September 27, 2012 13:52
jquery.draghover.js
/*
jquery.draghover.js
Emulates draghover event by tracking
dragenter / dragleave events of element + children.
https://gist.github.com/gists/3794126
http://stackoverflow.com/a/10310815/4196
@mhdhejazi
mhdhejazi / CopyAsanaTasks.php
Created October 24, 2012 16:43
Copy/Move project to a new workspace in Asana
function asanaRequest($methodPath, $httpMethod = 'GET', $body = null)
{
$apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api
$url = "https://app.asana.com/api/1.0/$methodPath";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
curl_setopt($ch, CURLOPT_USERPWD, $apiKey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@lefnire
lefnire / gist:4026626
Created November 6, 2012 18:40
Derby Community Info (Workflowy Export)
Derby Community Info
- Projects
- Codeparty (Brian & Nate)
"https://github.com/codeparty"
- Derby
"https://github.com/codeparty/derby"
- Derby Examples
"https://github.com/codeparty/derby-examples"
- Racer
@anantn
anantn / firebase_create.js
Last active November 20, 2023 23:17
Firebase: Creating data if it doesn't exist. This snippet creates a user only if it doesn't already exist.
function go() {
var userId = prompt('Username?', 'Guest');
var userData = { name: userId };
tryCreateUser(userId, userData);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userCreated(userId, success) {
if (!success) {
@xem
xem / LICENSE.txt
Last active October 29, 2022 09:55 — forked from 140bytes/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE