Skip to content

Instantly share code, notes, and snippets.

View samplereality's full-sized avatar

Mark Sample samplereality

View GitHub Profile
@jinstrive
jinstrive / remove_emoji.py
Created October 22, 2015 07:40
python remove emoji in string
def remove_emoji(data):
"""
去除表情
:param data:
:return:
"""
if not data:
return data
if not isinstance(data, basestring):
return data
@aparrish
aparrish / glitchstr.py
Created February 2, 2015 16:07
a little set of functions I've been using to create "glitchy" strings.
import random
def char_error(s):
t = ""
for ch in s:
if random.randrange(6) == 0:
t += chr(ord(ch)+random.choice([-1,1]))
else:
t += ch
return t
@dariusk
dariusk / autocharts.js
Created July 8, 2014 18:36
Code snippet from @autocharts with an explanation
// I search twitter for the following strings. I'm looking specifically for questions that start with
// 'do you' or 'are you', but do not contain certain key words.
_.when(
search('"do you" -what -why -who -where -which -when -how'),
search('"are you" -what -why -who -where -which -when -how')
)
.done(function(doYou,areYou) {
// I take the raw search results and I snip away
// the "do you" or "are you" and just grab the rest of the sentence. So "Are you a magician?" becomes
// "a magician". I collect a bunch of these. (I strip away "what" and similar, because "what are you
@ilazakis
ilazakis / bigfoot-default.css
Last active September 9, 2018 12:25
WP-Bigfoot, Support For Numeric Style Footnotes
.footnote-button { position: relative; z-index: 5; top: -0.15em; box-sizing: border-box; display: inline-block; padding: 0.34em; margin: 0 0.1em 0 0.2em; border: none; border-radius: 0.3em; cursor: pointer; opacity: 0.3; background-color: #464646; line-height: 0; vertical-align: middle; text-decoration: none; -webkit-transition-property: opacity; -moz-transition-property: opacity; -ms-transition-property: opacity; transition-property: opacity; -webkit-transition-duration: 0.25s; -moz-transition-duration: 0.25s; -ms-transition-duration: 0.25s; transition-duration: 0.25s; }
.footnote-button:hover { opacity: 0.6; }
.footnote-button:active { opacity: 0.6; }
.footnote-button.active { opacity: 0.9; -webkit-transition-delay: 0.15s; -moz-transition-delay: 0.15s; -ms-transition-delay: 0.15s; transition-delay: 0.15s; }
.footnote-circle { display: inline-block; width: 0.32em; height: 0.32em; margin-right: 0.224em; border-radius: 100%; background-color: #e6e6e6; border: none; line-height: 0.5em; }
.footnote-circle:last-
@zachwhalen
zachwhalen / botcode.pl
Created February 28, 2014 22:57
This is a slightly cleaned up version of the code that runs @rom_txt. It's pretty simple -- it just loads a big text file and picks a random few lines.
#/usr/bin/local/perl
use Net::Twitter;
use Data::Dumper;
use LWP::Simple;
# get API credentials at http://dev.twitter.com
my $nt = Net::Twitter->new(
traits => [qw/API::RESTv1_1/],