Arne  Denesik

Arne Denesik

1602292920

The hashtag to rule them all 👉 Analysis of company tweets

We rush through things and rarely stop to smell the flowers. The Stoics tell us to ponder the bigger picture of our lives, I decided to stop and analyse the bigger picture of our brand’s Twitter account.

We can poetically title this data analysis as 💐 The Smell of the Twitter Flowers.

Goals

A lot can be done with Twitter data and, trust me, I tortured it almost all the way I could (see current version of the notebook). But, for this post we’ll focus on the frequency and use of hashtags and mentions. There will soon be other posts about such delicious topics like correlations, emojis, and saddest days in the week.

👉 Let’s jam: The dataset

The dataset has been downloaded from Twitter Analytics, and covers the period form April to September 2020. As much as I’d love to have more, Twitter doesn’t store data going further back or, if it does, it doesn’t make it available to the account owner.

The dataset includes all the tweets sent in this period from the account @makingjam. Most of these glorious, JAMmy tweets have been written by me so any ensuing text analysis will be an insight into my marketing brain and sense of humour — brace yourselves.

#visualization #python #data-visualisation #twitter #data-analysis

What is GEEK

Buddha Community

The hashtag to rule them all 👉 Analysis of company tweets
Rupert  Beatty

Rupert Beatty

1666209000

ActiveLabel.swift: UILabel drop-in replacement supporting Hashtags (#)

ActiveLabel.swift

UILabel drop-in replacement supporting Hashtags (#), Mentions (@), URLs (http://), Emails and custom regex patterns, written in Swift

Features

  • Swift 5.0 (1.1.0+) and 4.2 (1.0.1)
  • Default support for Hashtags, Mentions, Links, Emails
  • Support for custom types via regex
  • Ability to enable highlighting only for the desired types
  • Ability to trim urls
  • Super easy to use and lightweight
  • Works as UILabel drop-in replacement
  • Well tested and documented
demo.gif

Install (iOS 10+)

Carthage

Add the following to your Cartfile and follow these instructions

github "optonaut/ActiveLabel.swift"

CocoaPods

CocoaPods 0.36 adds supports for Swift and embedded frameworks. To integrate ActiveLabel into your project add the following to your Podfile:

platform :ios, '10.0'
use_frameworks!

pod 'ActiveLabel'

Usage

import ActiveLabel

let label = ActiveLabel()
label.numberOfLines = 0
label.enabledTypes = [.mention, .hashtag, .url, .email]
label.text = "This is a post with #hashtags and a @userhandle."
label.textColor = .black
label.handleHashtagTap { hashtag in
    print("Success. You just tapped the \(hashtag) hashtag")
}

Custom types

let customType = ActiveType.custom(pattern: "\\swith\\b") //Regex that looks for "with"
label.enabledTypes = [.mention, .hashtag, .url, .email, customType]
label.text = "This is a post with #hashtags and a @userhandle."
label.customColor[customType] = UIColor.purple
label.customSelectedColor[customType] = UIColor.green
label.handleCustomTap(for: customType) { element in
    print("Custom type tapped: \(element)")
}

Enable/disable highlighting

By default, an ActiveLabel instance has the following configuration

label.enabledTypes = [.mention, .hashtag, .url, .email]

But feel free to enable/disable to fit your requirements

Batched customization

When using ActiveLabel, it is recommended to use the customize(block:) method to customize it. The reason is that ActiveLabel is reacting to each property that you set. So if you set 3 properties, the textContainer is refreshed 3 times.

When using customize(block:), you can group all the customizations on the label, that way ActiveLabel is only going to refresh the textContainer once.

Example:

label.customize { label in
    label.text = "This is a post with #multiple #hashtags and a @userhandle."
    label.textColor = UIColor(red: 102.0/255, green: 117.0/255, blue: 127.0/255, alpha: 1)
    label.hashtagColor = UIColor(red: 85.0/255, green: 172.0/255, blue: 238.0/255, alpha: 1)
    label.mentionColor = UIColor(red: 238.0/255, green: 85.0/255, blue: 96.0/255, alpha: 1)
    label.URLColor = UIColor(red: 85.0/255, green: 238.0/255, blue: 151.0/255, alpha: 1)
    label.handleMentionTap { self.alert("Mention", message: $0) }
    label.handleHashtagTap { self.alert("Hashtag", message: $0) }
    label.handleURLTap { self.alert("URL", message: $0.absoluteString) }
}

Trim long urls

You have the possiblity to set the maximum lenght a url can have;

label.urlMaximumLength = 30

From now on, a url that's bigger than that, will be trimmed.

https://afancyurl.com/whatever -> https://afancyurl.com/wh...

API

mentionColor: UIColor = .blueColor()

mentionSelectedColor: UIColor?

hashtagColor: UIColor = .blueColor()

hashtagSelectedColor: UIColor?

URLColor: UIColor = .blueColor()

URLSelectedColor: UIColor?

customColor: [ActiveType : UIColor]

customSelectedColor: [ActiveType : UIColor]

lineSpacing: Float?

handleMentionTap: (String) -> ()

label.handleMentionTap { userHandle in print("\(userHandle) tapped") }

handleHashtagTap: (String) -> ()

label.handleHashtagTap { hashtag in print("\(hashtag) tapped") }

handleURLTap: (NSURL) -> ()

label.handleURLTap { url in UIApplication.shared.openURL(url) }

handleEmailTap: (String) -> ()

label.handleEmailTap { email in print("\(email) tapped") }

handleCustomTap(for type: ActiveType, handler: (String) -> ())

label.handleCustomTap(for: customType) { element in print("\(element) tapped") }

filterHashtag: (String) -> Bool

label.filterHashtag { hashtag in validHashtags.contains(hashtag) }

filterMention: (String) -> Bool

label.filterMention { mention in validMentions.contains(mention) }

Alternatives

Before writing ActiveLabel we've tried a lot of the following alternatives but weren't quite satisfied with the quality level or ease of usage, so we decided to contribute our own solution.

  • TTTAttributedLabel (ObjC) - A drop-in replacement for UILabel that supports attributes, data detectors, links, and more
  • STTweetLabel (ObjC) - A UILabel with #hashtag @handle and links tappable
  • AMAttributedHighlightLabel (ObjC) - A UILabel subclass with mention/hashtag/link highlighting
  • KILabel (ObjC) - A simple to use drop in replacement for UILabel for iOS 7 and above that highlights links such as URLs, twitter style usernames and hashtags and makes them touchable

Download Details:

Author: optonaut
Source Code: https://github.com/optonaut/ActiveLabel.swift 
License: MIT license

#swift #hashtags #twitter 

Expanding RichText in Flutter

Expandable RichText

A text widget that you can use to initially only show a defined number of lines of a probably long text. It also supports clickable @‌mention, #hashtag, and hyperlinks. You can define styles for @‌mention, #hashtag, and hyperlinks and apply custom styles on text segments.

Features

  • Collapse and Expand text
  • Configure text to show to Expand text (expandText) and to Collapse text (collapseText)
  • Control whether the ellipsis (showEllipsis) is part of the Expand/Collapse text
  • Expand and Collapse animation
  • Callback for expanded changed event (onExpandedChanged)
  • Apply different style at @‌mention, #hashtag, hyperlinks and text segments
  • Handle click on @‌mention, #hashtag, hyperlinks and text segments
  • Programmatically expand and collapse text

Example with maxLines=1

Getting started

Add this to your package's pubspec.yaml file:

dependencies:
  expandable_richtext: 1.0.0

Next, import the package into your dart code:

import 'package:expandable_rich_text/expandable_richtext.dart';

Usage

If longText exceeds two lines:

Widget build(BuildContext context) {
  return ExpandableRichText(
    text: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
    expandText: 'show more',
    collapseText: 'show less',
    maxLines: 2,
    linkColor: Colors.blue,
  );
}

If longText have @‌mention, #hashtag, hyperlinks and text segments:

Widget build(BuildContext context) {
  return ExpandableRichText(
      text: "Lorem ipsum dolor sit amet..., #consetetur @sadipscing elitr, <tag1>I am Admin1</tag1> tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. <tag2>I am employee1</tag2> At vero eos et accusam et justo duo dolores et ea rebum Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum www.galley.com dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, <tag1>I am Admin2</tag1> diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. <tag2>I am employee2</tag2> Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
      expandText: 'show more',
      collapseText: 'show less',
      maxLines: 1,
      linkColor: Colors.blue,
      mentionStyle: const TextStyle(
          color: Colors.blueAccent, fontSize: 16, fontWeight: FontWeight.bold),
      hashtagStyle: const TextStyle(
          fontSize: 16, color: Colors.white, backgroundColor: Colors.black87),
      urlStyle: const TextStyle(
          color: Colors.lightBlueAccent, decoration: TextDecoration.underline),
      customTagStyle: const TextStyle(fontWeight: FontWeight.bold,
          fontStyle: FontStyle.italic,
          fontSize: 16,
          color: Colors.white,
          backgroundColor: Colors.lightBlueAccent,
          decoration: TextDecoration.underline)
  );
}

Advance Usage

Widget build(BuildContext context) {
  return ExpandableRichText(
    text: "Lorem ipsum dolor sit amet..., #consetetur @sadipscing elitr, <tag1>I am Admin1</tag1> tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. <tag2>I am employee1</tag2> At vero eos et accusam et justo duo dolores et ea rebum Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum www.galley.com dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, <tag1>I am Admin2</tag1> diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. <tag2>I am employee2</tag2> Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
    expandText: 'show more',
    collapseText: 'show less',
    expanded: false,
    onExpandedChanged: (flag) => {},
    toggleTextColor: Colors.black,
    showEllipsis: true,
    toggleTextStyle: const TextStyle(
        fontSize: 12, color: Colors.blue, decoration: TextDecoration.underline),
    urlStyle: const TextStyle(color: Colors.lightBlueAccent, decoration: TextDecoration.underline),
    onUrlTap: (url) => {},
    hashtagStyle: const TextStyle(
        fontSize: 16, color: Colors.white, backgroundColor: Colors.black87),
    mentionStyle: const TextStyle(
        color: Colors.blueAccent, fontSize: 16, fontWeight: FontWeight.bold),
    onMentionTap: (mention) => {},
    customTagStyle: const TextStyle(fontWeight: FontWeight.bold,
        fontStyle: FontStyle.italic,
        fontSize: 16,
        color: Colors.white,
        backgroundColor: Colors.lightBlueAccent,
        decoration: TextDecoration.underline),
    onCustomTagTap: (tag) => {},
    expandOnTextTap: true,
    collapseOnTextTap: true,
    style: const TextStyle(color: Colors.black, fontSize: 24),
    textDirection: TextDirection.ltr,
    textAlign: TextAlign.start,
    textScaleFactor: 1.0,
    maxLines: 2,
    animation: true,
    animationDuration: const Duration(milliseconds: 200),
    animationCurve: Curves.fastLinearToSlowEaseIn,
  );
}

Bugs and feature requests

Have a bug or a feature request? Please first search for existing and closed issues. If your problem or idea is not addressed yet, please open a new issue.

Author

DevCrew I/O

Connect with Us: devcrew.io devcrew.io 

Contributing

Contributions, issues, and feature requests are welcome!

Show your Support

Give a start if this project helped you.

Copyright & License

Code copyright 2023 DevCrew I/O. Code released under the MIT license.

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add expandable_richtext

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  expandable_richtext: ^1.0.0

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:expandable_richtext/expandable_rich_text.dart';
import 'package:expandable_richtext/text_parser.dart';
import 'package:expandable_richtext/text_segment.dart'; 

example/lib/main.dart

import 'package:example/values/strings.dart';
import 'package:example/values/styles.dart';
import 'package:flutter/material.dart';
import 'package:expandable_richtext/expandable_rich_text.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    const title = "Expandable Rich Text Example";
    return MaterialApp(
      title: title,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: title),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    //margin
    const verticalMargin = SizedBox(
      height: 20,
    );
    const titleMargin = SizedBox(
      height: 8,
    );

    //simple text
    Text simpleTextTitle = Text(
      titleSimpleText,
      style: titleTextStyle,
    );

    //simple expandable text
    Text simpleExpandableTextTitle = Text(
      titleSimpleExpandableText,
      style: titleTextStyle,
    );

    //mention text
    Text mentionTextTitle = Text(
      titleMentionText,
      style: titleTextStyle,
    );

    //hashtag text
    Text hashtagTextTitle = Text(
      titleHashtagText,
      style: titleTextStyle,
    );

    //url text
    Text urlTextTitle = Text(
      titleUrlText,
      style: titleTextStyle,
    );

    //custom tag text
    Text customTagTitle = Text(
      titleCustomTagText,
      style: titleTextStyle,
    );

    //multiple custom tag text
    Text multiCustomTagTitle = Text(
      titleMultipleCustomTagText,
      style: titleTextStyle,
    );

    //all text
    Text allTextTitle = Text(
      titleAllText,
      style: titleTextStyle,
    );

    //programmatically handle text toggle
    Text programmaticallyHandleTitle = Text(
      titleProgrammaticallyHandle,
      style: titleTextStyle,
    );

    /// a text to collapse and expand programmatically
    final programmaticExpandableRichText = ExpandableRichText(
      plainText,
      expandText: expandingText,
      collapseText: collapsingText,
    );

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: ListView(
        padding: const EdgeInsets.all(20),
        shrinkWrap: true,
        children: [
          simpleTextTitle,
          titleMargin,
          ExpandableRichText(
            plainText, //assume this comes from backend
          ),
          verticalMargin,
          simpleExpandableTextTitle,
          titleMargin,
          ExpandableRichText(
            plainText, //assume this comes from backend
            expandText: expandingText,
            collapseText: collapsingText,
            toggleTextStyle: linkTextStyle,
          ),
          verticalMargin,
          mentionTextTitle,
          titleMargin,
          ExpandableRichText(
            mentionText, //assume this comes from backend
            expandText: expandingText,
            collapseText: collapsingText,
            toggleTextStyle: linkTextStyle,
            mentionStyle: mentionTextStyle,
          ),
          verticalMargin,
          hashtagTextTitle,
          titleMargin,
          ExpandableRichText(
            hashTagText, //assume this comes from backend
            expandText: expandingText,
            collapseText: collapsingText,
            toggleTextStyle: linkTextStyle,
            hashtagStyle: hashTagTextStyle,
          ),
          verticalMargin,
          urlTextTitle,
          titleMargin,
          ExpandableRichText(
            urlText, //assume this comes from backend
            expandText: expandingText,
            collapseText: collapsingText,
            toggleTextStyle: linkTextStyle,
            urlStyle: urlTextStyle,
          ),
          verticalMargin,
          customTagTitle,
          titleMargin,
          ExpandableRichText(
            tagsText, //assume this comes from backend
            expandText: expandingText,
            collapseText: collapsingText,
            toggleTextStyle: linkTextStyle,
            customTagStyle: customTagStyle,
          ),
          verticalMargin,
          multiCustomTagTitle,
          titleMargin,
          ExpandableRichText(
            tagsText, //assume this comes from backend
            expandText: expandingText,
            collapseText: collapsingText,
            toggleTextStyle: linkTextStyle,
            customTagStyles: customTagStyleMap,
          ),
          verticalMargin,
          allTextTitle,
          titleMargin,
          ExpandableRichText(
            allText, //assume this comes from backend
            expandText: expandingText,
            collapseText: collapsingText,
            toggleTextStyle: linkTextStyle,
            mentionStyle: mentionTextStyle,
            hashtagStyle: hashTagTextStyle,
            customTagStyle: customTagStyle,
          ),
          verticalMargin,
          programmaticallyHandleTitle,
          titleMargin,
          Align(
            alignment: Alignment.topLeft,
            child: ElevatedButton(
                onPressed: () =>
                    {programmaticExpandableRichText.toggle?.call()},
                child: const Text("Toggle")),
          ),
          titleMargin,
          programmaticExpandableRichText
        ],
      ),
    );
  }
} 

Download Details:

Author: DevCrew-io

Source Code: https://github.com/DevCrew-io/expandable-richtext

#flutter #android 

Top IT Companies in Chandigarh | Wing Global IT Services Pvt. Ltd.

WINGGS is a leading web designing company in Chandigarh. Showcase your brand powerfully with our web design services. We are a leading web design company that creates websites that are responsive, fast-loading, and user-friendly, with a consistent appearance and use across different web browsers. Contact us and get the best solution today!

#web designing company in chandigarh #best it company in chandigarh #top it companies in chandigarh #web designing company in mohali #web design company in chandigarh #it company in chandigarh

Software development and Maintenance Support company

ROI-Driven Software Development Company
‘Leave no stone unturned’ is the prime mover of Tvisha Technologies, an ISO certified mobile app and software companies in hyderabad in devising cutting-edge strategies. Empowered by 18+ years of experience, our MNC company has gained worldwide attention for its several historical milestones. The technocrats here adopt and implement new technologies as soon as they arrived. They work as there is no tomorrow that helps them deliver fast-track IT solutions.

Moreover, Commitment throughout the sprints, Transparency in the communication, and Timely delivery even for complex projects are three main reasons that make us recognized as one of the top software companies in Hyderabad. Our engineering professionals capture the business idea of clients in the first time of consultation itself and transform their business requirements into ready-to-use software. Throughout the execution of projects, all the teams of designers and developers will be on the same line to deliver high-quality products. And they keep clients informed on the status of the project through daily reports and work until they satisfy. This makes our IT company own clients’ appreciation, trust, and loyalty.

Now, for many businesses from startups to SMEs, we have become a fountainhead for delivering various top-notch mobile & web applications and robust software for variegated fields. All these make us listed in Goodfirms, Clutch, itfirms, Top developers, appfutura, etc. that results in recognized us as one of the top IT companies in India

#software companies in hyderabad #top software companies in hyderabad #best software companies in hyderabad #it software companies in hyderabad #software mnc companies in hyderabad #software development companies in hyderabad

Top IT Companies in Chandigarh | Wings Global IT Services Pvt. Ltd.

Wings Global IT Services Pvt. Ltd. is one of the best IT companies in Chandigarh providing top-notch sales and IT solutions. We have over a decade of experience in web designing, web development, and the digital marketing field. We have a team of skilled professionals making us one of the top IT companies in Chandigarh. Feel free to ask your questions about the projects. We will be happy to help you to find the best solution. Contact us now 7009125475.

#top it companies in chandigarh #best it companies in chandigarh #java companies in chandigarh #digital marketing company in chandigarh #web designing company in chandigarh #mobile app development company in chandigarh