Skip to content

Instantly share code, notes, and snippets.

@icodeforlove
icodeforlove / generate_keyframe_animation.js
Last active October 5, 2015 15:47
helper for generating static css for keyframe animations
function generate_keyframe_animation (name, frames, height) {
var steps = [];
for (var frame = 0; frame < frames; frame++) {
var percent = ((frame / (frames - 1)) * 100).toFixed(2);
steps.push('\t' + percent + '% { background-position: 0px ' + (-height * frame) + 'px; }');
}
return '@-webkit-keyframes ' + name + ' {\n' + steps.join('\n') + '\n}';
@changux
changux / gist:2321971
Created April 6, 2012 18:38
Check Flashback Trojan
display dialog "Lets go to check two simple values, if the result is not equal to OK, run some antivirus or do your job with the terminal app. Also, check http://goo.gl/3FWfA" with icon stop with title "Simple Flashback Trojan detect tool"
try
set test1 to do shell script "defaults read /Applications/Safari.app/Contents/Info LSEnvironment > /tmp/nada 2>&1; cat /tmp/nada | grep -i not"
set test1 to result
if test1 contains "does not exist" then
display dialog "Step 1: OK" with icon note
do shell script "rm -f /tmp/nada"
else
@drinchev
drinchev / gist:2266544
Created March 31, 2012 16:26
Integrate NowJS with Express and Passport
var express = require('express')
, passport = require('passport')
, sessionStore = new express.session.MemoryStore()
, app = module.exports = express.createServer()
, nowjs = require('now');
app.configure( function () {
app.use(express.bodyParser());
@richardqin
richardqin / monitor with stub moduel
Created March 25, 2012 12:37
monitor the status of nginx
location /nginx_status {
stub_status on;
access_log off;
allow 192.168.1.1;
deny all;
}
active connections:nginx 正处理的活动连接数 20个。
server accepts handled requests:nginx启动到现在共处理了 200个连接 , 成功创建 200 次握手 一般跟第一个一样,差值为请求丢失数。
reading :nginx 读取到客户端的 Header 信息数。
@mrsnippets
mrsnippets / JS - Placeholder Cross-browser
Created March 25, 2012 12:18
JS - Placeholder cross-browser
if(!Modernizr.input.placeholder){
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
if (input.val() == '' || input.val() == input.attr('placeholder')) {
@jquery404
jquery404 / gist:2191565
Created March 25, 2012 05:40
Fun with KeyCode
$('#searchbox input').bind('keydown', function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
if(e.shiftKey){
$('.dialpad').append('<span class="dial">Shift</span>\n');
event.preventDefault();
}else if(e.altKey){
$('.dialpad').append('<span class="dial">Alt</span>\n');
event.preventDefault();
}else if(e.ctrlKey){
@s4l1h
s4l1h / CronFix.php
Created February 26, 2012 17:17
Bir komutu saniye cinsinden istediğimiz sürede çalıştırmaya yarar.
<?php
ini_set('max_execution_time', 0);
set_time_limit(0);
header('Content-type: text/html; charset=utf-8');
// php çalıştırılma çekli
if (PHP_SAPI !== 'cli') {
echo "Bu Uygulama Sadece Konsoldan Çalışır";
exit;
}
// Zaman
@e000
e000 / socks.py
Created March 14, 2011 20:21
socksipy + urllib2 handler
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
@azer
azer / gist:165678
Created August 11, 2009 07:18
PostgreSQL Notlari
===========================================================================================
YARDIM ALMAK
------------
fonksiyonlar hakkinda yardim almak:
insert into t1 select generate_series(1,500);
\df
http://postgresql.org/docs/books/volkanyazici
CREATE OPERATOR (OHA)
----------------