Skip to content

Instantly share code, notes, and snippets.

@leplay
leplay / gist:8595855
Last active January 4, 2016 08:29 — forked from JosephPecoraro/shell-execution.rb
Ways to execute a shell script in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Returns the result of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@leplay
leplay / weibo
Created October 29, 2014 12:19
Back to V5
document.cookie = "wvr=5; path=/; domain=.weibo.com";
document.cookie = "wvr6=0; path=/; domain=.weibo.com";
location.reload();
@leplay
leplay / weibo
Created October 29, 2014 12:24
Back to V6
document.cookie = "wvr=6; path=/; domain=.weibo.com";
document.cookie = "wvr6=1; path=/; domain=.weibo.com";
location.reload();
@leplay
leplay / weibo
Created October 29, 2014 14:45
Random
var random = Math.round(Math.random());
document.cookie = "wvr=" + (5 + random) + "; path=/; domain=.weibo.com";
document.cookie = "wvr6=" + random + "; path=/; domain=.weibo.com";
location.reload();
@leplay
leplay / apple.js
Last active August 29, 2015 14:08
Check iPhone 6
var map = {
R079: '銀座',
R119: '渋谷',
R224: '表参道'
};
var model = ['MG4F2J/A', 'MG4J2J/A'];
// 灰色 64G, 金色 64G
function check() {
@leplay
leplay / playlist.yaml
Last active April 20, 2021 10:29
Lost in Music
- title:108: 题外话 之3
主题: 108: 题外话 之3
主播: 贺愉(新浪微博@贺愉;微信公众号: 迷失音乐)
封面设计: 阿喵
简介: 叨逼叨逼叨
歌单:
01.London Grammar - Shyer
02.Mira Billotte(White Magic) - As I Went Out One Morning
03.Bob Dylan - As I Went Out One Morning
@leplay
leplay / formatDate.js
Last active September 19, 2019 09:18 — forked from eikes/date.format.js
format date / es6 / case style
/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
* MIT license
*
* Includes enhancements by Scott Trenda <scott.trenda.net>
* and Kris Kowal <cixar.com/~kris.kowal/>
* and leplay <https://gist.github.com/leplay/e9fafa24e29d8bfe5688>
*
* Accepts a date, a mask, or a date and a mask.
@leplay
leplay / FormatDate.js
Last active February 23, 2018 05:58
FormatDate.js
(function (window) {
define([], function () {
var FormatDate = function (format, date) {
date = date ? new Date(parseInt(date, 10)) : new Date();
var output = format.replace(/y{4}|D{2}|M{2}|d{2}|h{2}|H{2}|m{2}|s{2}/g, function (keyword) {
var result = '';
switch (keyword) {
case 'yyyy':
var counter = {};
var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
_.each(dayNames, function(name) {
counter[name] = 0;
})
$.ajax({
url: 'https://www.producthunt.com/frontend/collections/the-1000-club?id=the-1000-club'
}).done(function(resp){
// http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));