Skip to content

Instantly share code, notes, and snippets.

View yitsushi's full-sized avatar
🏳️‍⚧️

Victoria Nadasdi yitsushi

🏳️‍⚧️
View GitHub Profile
<?php
$with_unsused = false;
define('LIMIT', 1000000);
class MyClass {
public function test() {}
}
function callSomething() {
Verifying my Blockstack ID is secured with the address 1JpEjoxTu3d4gMDipmgrekXRvkENs9Ya7r
# Select them
jQuery('.wishlistRow').on('click', function() { jQuery(this).toggleClass('wanttoremove'); });
# Finish
jQuery('.wanttoremove').each(function() {
var id = this.getAttribute('id').split('_')[1];
jQuery.post(
'/id/yitsushi/wishlist/',
{
appid: id,
@yitsushi
yitsushi / git-update-from-remote.sh
Created October 7, 2016 11:16
fetch remote branch and rebase it. If working directory is dirty than stash them first and apply stash after update
# stashq is an alias to prevend auto-sign stashes (prompt for password):
# git config --global alias.stashq '-c commit.gpgsign=false stash'
function update-from-remote() {
remote=${1:-"origin"}
branch=${2:-"master"}
if ! git remote | grep "${remote}" > /dev/null; then
echo "There is no remote like ${remote}"
return 1
fi
@yitsushi
yitsushi / delete_my_slack_files.rb
Created October 3, 2016 15:51
delete old slack files (only images)
require "slack"
#
# gem install slack-api
#
# Get the token from here: https://api.slack.com/docs/oauth-test-tokens
#
client = Slack::Client.new token: ENV['TOKEN']
@yitsushi
yitsushi / delete_slack_files.rb
Last active October 3, 2016 15:49
set Env TOKEN to your personal (or an admin) token (bot token does not work)
require "slack"
client = Slack::Client.new token: ENV['TOKEN']
LIMIT = 20 # days
from_time = Time.now.to_i - (60 * 60 * 24 * LIMIT)
pages = client.files_list(:types => 'images', ts_to: from_time)['paging']['pages'].to_i
deleted_files_count = 0

Keybase proof

I hereby claim:

  • I am yitsushi on github.
  • I am yitsushi (https://keybase.io/yitsushi) on keybase.
  • I have a public key whose fingerprint is 37D5 583D 863D 4312 835C 5C2B CA6D FB19 D2C8 9810

To claim this, I am signing this object:

<?php
function test_permutations_rob($items, $perms = [], &$return = []) {
if (empty($items)) {
$return[] = $perms;
} else {
sort($items);
$prev = false;
for ($i = count($items) - 1; $i >= 0; --$i) {
$newitems = $items;
@yitsushi
yitsushi / test.rb
Last active May 17, 2016 10:23
Ruby public, protected, private calls
class A
public
def pub_test
puts "A::pub_test"
print " ->"
prot_test
print " ->"
priv_test
end
@yitsushi
yitsushi / pre-commit
Created February 9, 2016 14:57
"php -l" before commit
#!/usr/bin/env php
<?php
$files = array();
$returnValue = 0;
$exitStatus = 0;
$acceptedExtensions = array('php');
# git revision
exec('git rev-parse --verify HEAD 2> /dev/null', $files, $returnValue);