Skip to content

Instantly share code, notes, and snippets.

View kssminus's full-sized avatar

김성식 kssminus

  • kakaocorp
  • yongin
View GitHub Profile
@besstiolle
besstiolle / RegexPatternCron.md
Last active November 16, 2016 12:45
Standard/Default implementations of Cron expression syntax check, including special operators : * / , - and Nonstandard predefined scheduling definitions

Tldr

Here the cron regex :

(((\*)|(([0-9]|[0-5][0-9]))|(((\*|([0-9]|[0-5][0-9]))\/([0-9]|[0-5][0-9])))|(([0-9]|[0-5][0-9])(,([0-9]|[0-5][0-9]))*)|(([0-9]|[0-5][0-9])-([0-9]|[0-5][0-9])(\/([0-9]|[0-5][0-9]))?)) ((\*)|(([0-9]|[0-1][0-9]|2[0-3]))|(((\*|([0-9]|[0-1][0-9]|2[0-3]))\/([0-9]|[0-1][0-9]|2[0-3])))|(([0-9]|[0-1][0-9]|2[0-3])(,([0-9]|[0-1][0-9]|2[0-3]))*)|(([0-9]|[0-1][0-9]|2[0-3])-([0-9]|[0-1][0-9]|2[0-3])(\/([0-9]|[0-1][0-9]|2[0-3]))?)) ((\*)|(([0-9]|[0-1][0-9]|3[0-1]))|(((\*|([0-9]|[0-1][0-9]|3[0-1]))\/([0-9]|[0-1][0-9]|3[0-1])))|(([0-9]|[0-1][0-9]|3[0-1])(,([0-9]|[0-1][0-9]|3[0-1]))*)|(([0-9]|[0-1][0-9]|3[0-1])-([0-9]|[0-1][0-9]|3[0-1])(\/([0-9]|[0-1][0-9]|3[0-1]))?)) ((\*)|(([0-9]|0[0-9]|1[0-2]))|(((\*|([0-9]|0[0-9]|1[0-2]))\/([0-9]|0[0-9]|1[0-2])))|(([0-9]|0[0-9]|1[0-2])(,([0-9]|0[0-9]|1[0-2]))*)|(([0-9]|0[0-9]|1[0-2])-([0-9]|0[0-9]|1[0-2])(\/([0-9]|0[0-9]|1[0-2]))?)) ((\*)|(([0-7]))|(((\*|([0-7]))\/([0-7])))|(([0-7])(,([0-7]))*)|(([0-7])-([0-7])(\/([0-7]))?)))|(@reboot|@yearly|@annually|@
@paulakreuger
paulakreuger / angular-filters.js
Last active October 18, 2023 19:34
Capitalize First Letter Filter - AngularJS
app.filter('capitalize', function() {
return function(input, scope) {
if (input!=null)
input = input.toLowerCase();
return input.substring(0,1).toUpperCase()+input.substring(1);
}
});
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@nodesocket
nodesocket / logstash
Created July 7, 2013 01:18
LogStash init.d service script.
#! /bin/sh
#
# /etc/rc.d/init.d/logstash
#
# Starts Logstash as a daemon
#
# chkconfig: 2345 20 80
# description: Starts Logstash as a daemon
### BEGIN INIT INFO
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 27, 2025 18:23
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@thomseddon
thomseddon / gist:3511330
Last active March 8, 2023 03:39
AngularJS byte format filter
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@iiska
iiska / db_fixtures_dump.rake
Created December 28, 2011 13:17
Dump Rails db to fixtures
# Original from http://snippets.dzone.com/posts/show/4468 by MichaelBoutros
#
# Optimized version which uses to_yaml for content creation and checks
# that models are ActiveRecord::Base models before trying to fetch
# them from database.
namespace :db do
namespace :fixtures do
desc 'Dumps all models into fixtures.'
task :dump => :environment do
models = Dir.glob(RAILS_ROOT + '/app/models/**.rb').map do |s|