Skip to content

Instantly share code, notes, and snippets.

Avatar

KINOSHITA Shinji snj

  • HAPPY SCIENCE
  • Tokyo
View GitHub Profile
@zmts
zmts / fingerprint.md
Last active Apr 21, 2021
Get browser fingerprint example (fingerprintjs2)
View fingerprint.md

Get browser fingerprint example (fingerprintjs2)

import * as Fingerprint2 from 'fingerprintjs2'
import * as UAParser from 'ua-parser-js'

function _getFingerprint () {
  return new Promise((resolve, reject) => {
    async function getHash () {
      const options = {
@thomseddon
thomseddon / gist:4703968
Last active Oct 21, 2020
Auto Expanding/Grow textarea directive for AngularJS
View gist:4703968
/**
* The MIT License (MIT)
*
* Copyright (c) 2013 Thom Seddon
* Copyright (c) 2010 Google
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@rudyryk
rudyryk / gist:4190318
Created Dec 2, 2012
Override delete_selected in Django admin
View gist:4190318
from django.core.exceptions import PermissionDenied
from django.contrib import admin
from django.contrib.admin.actions import delete_selected as delete_selected_
def delete_selected(modeladmin, request, queryset):
if not modeladmin.has_delete_permission(request):
raise PermissionDenied
if request.POST.get('post'):
for obj in queryset:
@dtao
dtao / increment_decrement.py
Created May 25, 2012
Sublime Text plugin to increment/decrement all selected numbers
View increment_decrement.py
import sublime
import sublime_plugin
class NumberCommand(sublime_plugin.TextCommand):
def run(self, edit):
selection = self.view.sel()
for region in selection:
try:
value = int(self.view.substr(region))
self.view.replace(edit, region, str(self.op(value)))
@jcsrb
jcsrb / gist:1081548
Created Jul 13, 2011
get avatar from google profiles, facebook, gravatar, twitter, tumblr
View gist:1081548
function get_avatar_from_service(service, userid, size) {
// this return the url that redirects to the according user image/avatar/profile picture
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px )
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word )
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word )
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px )
// everything else will go to the fallback
// google and gravatar scale the avatar to any site, others will guided to the next best version